3 solutions
-
1
关键pattern
0110
1001
,让0110
不断重复,然后再根据讨论即可。#include<bits/stdc++.h> using namespace std; int main(){ int T=1; while(T--){ int n; cin>>n; if(n==2) printf("01"); else if(n==3) printf("wasted"); else if(n==4) printf("0110"); else if(n==5) printf("01010"); else if(n==6) printf("010001"); else if(n==7) printf("0110001"); else if(n%4==0) for(int t=1;t<=n/4;++t) printf("0110"); else if(n%4==1) { printf("011000110"); for(int t=3;t<=n/4;++t) printf("0110"); }else if(n%4==2) { printf("10"); for(int t=1;t<=n/4;++t) printf("0110"); }else if(n%4==3){ printf("10011000110"); for(int t=3;t<=n/4;++t) printf("0110"); } putchar('\n'); } return 0; }
Information
- ID
- 154
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 6
- Tags
- # Submissions
- 153
- Accepted
- 42
- Uploaded By