本文共 997 字,大约阅读时间需要 3 分钟。
1 /* 2 水题 3 找规律输出 4 */ 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 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 }
转载于:https://www.cnblogs.com/Running-Time/p/4366702.html