Codeforces Round 937 (Div. 4)
B. Upscaling
..,##交替输出两次即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+10; string s[2]={"##",".."}; int n; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--) { cin >> n; for(int i=0;i<n;++i) { for(int j=0;j<n;j++) { cout << s[(j+i)%2]; } cout << "\n"; for(int j=0;j<n;j++) { cout << s[(i+j)%2]; } cout << "\n"; } } return 0; }
|