#include<bits/stdc++.h> using namespace std; vector <int> G[100+69]; int main(){ int k,i,n; scanf("%d",&k); n=100; printf("%d\n",n); for(i=1;i<=n-2;i++) G[i].push_back(i+1); for(i=1;i<=n-3;i+=2) G[i].push_back(i+2); for(i=2;i<=98;i+=2){ if(k%2) G[i].push_back(n); k/=2; } for(i=1;i<=n;i++){ for(auto j : G[i]) printf("%d ",j); for(auto j=0;j<2-(int)G[i].size();j++) printf("%d ",-1); printf("\n"); } return 0; }
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 | #include<bits/stdc++.h> using namespace std; vector <int> G[100+69]; int main(){ int k,i,n; scanf("%d",&k); n=100; printf("%d\n",n); for(i=1;i<=n-2;i++) G[i].push_back(i+1); for(i=1;i<=n-3;i+=2) G[i].push_back(i+2); for(i=2;i<=98;i+=2){ if(k%2) G[i].push_back(n); k/=2; } for(i=1;i<=n;i++){ for(auto j : G[i]) printf("%d ",j); for(auto j=0;j<2-(int)G[i].size();j++) printf("%d ",-1); printf("\n"); } return 0; } |