4 solutions
-
1
这道题怎么压最短? 老学弟的肯定
#import<ios> char s[101];int n,m,a,i;main(){freopen("three.in","r",stdin);freopen("three.out","w",stdout);scanf("%d%d",&n,&m);for(;i<n&&a<m;++i)if(i<2||s[i-1]!='1'||s[i-2]!='1')s[i]='1',a++;else s[i]='0';while(i<n)s[i++]='0';printf("%s",s);}切记“能运行就是好代码”
Information
- ID
- 4487
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 8
- Tags
- (None)
- # Submissions
- 550
- Accepted
- 78
- Uploaded By