找规律 Codeforces Round #290 (Div. 2) A. Fox And Snake
1 /*
2 水题
3 找规律输出
4 */
5 #include <cstdio>
6 #include <iostream>
7 #include <cstring>
8 #include <string>
9 #include <map>
10 #include <algorithm>
11 #include <vector>
12 #include <set>
13 #include <cmath>
14 using namespace std;
15
16 const int MAXN = 1e6 + 10;
17 const int INF = 0x3f3f3f3f;
18
19 int main(void)
20 {
21 //freopen ("A.in", "r", stdin);
22
23 string s[4];
24 int n, m;
25
26 while (cin >> n >> m)
27 {
28 for (int i=1; i<=3; ++i)
29 {
30 s[i] = "";
31 }
32 for (int i=0; i<=m-1; ++i)
33 {
34 s[1] += '#';
35 if (i != m - 1) s[2] += '.';
36 else s[2] += '#';
37 if (i == 0) s[3] += '#';
38 else s[3] += '.';
39 }
40
41 int x = n / 4;
42
43 for (int i=1; i<=x; ++i)
44 {
45 cout << s[1] << endl;
46 cout << s[2] << endl;
47 cout << s[1] << endl;
48 cout << s[3] << endl;
49 }
50
51 int y = n % 4;
52
53 for (int i=1; i<=y; ++i)
54 {
55 if (i == 3) cout << s[1] << endl;
56 else cout << s[i] << endl;
57 }
58 }
59
60 return 0;
61 }
编译人生,运行世界!