| ||||||||||
| 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:那位高手帮帮我,给我一个好的更改建议 Posted by:hongqin at 2005-11-08 17:11:35 > #include"stdio.h"
> void main()
> {
> int a[30],k[200];
> int i=0,j=0,m,t,s=0;
> do
> {
> scanf("%d",&k[i]);
> }while(k[i++]);
> do
> {
> for(j=0;j<30;j++)
> a[j]=0;
> for(m=k[s]+1;;m++)
> {
> for(i=0,t=0,j=1;i<k[s];j++,t++)
> {
> if(t==2*k[s])
> t=0;
> if(a[t]==m)
> {
> j--;
> continue;
> }
> if(j==m)
> {
> if(t+1>k[s])
> {
> i++;
> a[t]=m;
> j=0;
> }
> else
> break;
> }
> }
> if(i==k[s])
> {
> printf("%d\n",m);
> break;
> }
> }
> }while(k[++s]);
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator