Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

看下我的 貌似比你的短哈..

Posted by joy_w at 2009-03-20 23:18:36 on Problem 1068
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator