寒假算法基础集训营2 E题题解
比赛安排(PDF题面存放于本题)
https://ac.nowcoder.com/acm/contest/120562/A
如上图,找规律即可。一种简单的实现方式是min(行,列)&1。
附本人ac码:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define mod 998244353
const ll N=1e6+10;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin>>n;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<(min(i,j)&1);
}
cout<<endl;
}
return 0;
}
查看27道真题和解析