Codeforces Fox And Snake
来源:互联网 发布:高富帅标准 知乎 编辑:程序博客网 时间:2024/05/16 14:48
题目链接:http://codeforces.com/problemset/problem/510/A
import java.util.Scanner;public class FoxAndSnake {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int n = scanner.nextInt();int m = scanner.nextInt();String[][] strings = new String[n+1][m+1];for(int i = 1; i <=m; i++) {strings[1][i] = "#";}for(int i =2 ; i <= n; i++) {if(i % 2 == 0) {int k = i / 2;if(k % 2 != 0) {strings[i][m] = "#";strings[i][1] = ".";} else {strings[i][1] = "#";strings[i][m] = ".";}} else {strings[i][1] = "#";strings[i][m] = "#";}for(int j = 2; j < m; j++) {if(i % 2 == 0) {strings[i][j] = ".";} else {strings[i][j] = "#";}}}for(int i = 1; i <=n; i++) {for(int j = 1; j <= m; j++) {System.out.print(strings[i][j]);}System.out.println();}}}
阅读全文
0 0
- Codeforces Fox And Snake
- Codeforces 510 A.Fox and Snake
- CodeForces 510A Fox And Snake
- A. Fox And Snake
- A. Fox And Snake
- codeforces #290 A&&510A Fox And Snake(水题)
- A. Fox And Snake(Codeforces Round #290 (Div. 2))
- CodeForces 510 A. Fox And Snake(模拟啊 )
- Fox And Snake(Codeforces Round #290 (Div. 2)A)
- Codeforces Round #290 (Div. 2) A. Fox And Snake
- codeforces——510A——Fox And Snake
- 510A Fox And Snake
- Codeforces Round #290 (Div. 2) - - A. Fox And Snake (画图)
- codeforces510--A. Fox And Snake--B. Fox And Two Dots
- CF 510A(Fox And Snake-模拟)
- codeforces Fox and Cross
- codeforces Fox and Cross
- codeforces Fox and Box Accumulation
- leetcode8 atoi
- Install Grafana on Ubuntu 16.04 LTS
- java读取文件中的每一行
- 关于安装ubuntu、windows
- git 常用指令
- Codeforces Fox And Snake
- SVN 恢复至某个版本
- LinkedHashMap
- Java中equals()和==号的区别
- iOS 关于友盟微信分享成功回调不走的问题
- 设置Mybatis打印调试sql的两种方式
- 手摇算法(三重翻转算法)和空间复杂度为o(1)的归并排序
- 异常点检测算法(二)矩阵分解
- Memcache基础教程