!!!-->翻n-i枚硬币,就是有一枚硬币没有翻,相当于翻了一枚硬币
OK,上ACcode:
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=100+5;
int n,a[N];
void solve(){
cin>>n;
//反转n-1,其实相当于反转1个
cout<<n<<"\n";
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){//模拟
if(j!=i){
if(a[j]==0) a[j]=1;
else a[j]=0;
}
cout<<a[j];
}
cout<<"\n";
}
}
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
return 0;
}