Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
看下我的 貌似比你的短哈..In Reply To:纪念1次0MS AC,第一次写出这么短的代码。。嘿嘿 Posted by:yzhw at 2009-03-17 20:12:54 #include<stdio.h> int main() {int n; scanf("%d",&n); while(n--) {int k,i,a[30],b[60]={0}; scanf("%d",&k); for(i=0;i<k;i++) {scanf("%d",&a[i]);b[a[i]+i]=1;} for(i=0;i<2*k;i++) { if(b[i]==1) {int j,total=0; for(j=i;;j--) {if(b[j]==1) total++; if(b[j]==0){b[j]=2;break;} }printf("%d ",total); } } printf("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator