| ||||||||||
| 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 | |||||||||
那怎么老wa呢?帮忙看一看了,谢谢!In Reply To:不记得多大了,反正很小就是了。。。 Posted by:wth at 2005-07-09 21:39:56 #include<iostream.h>
void main()
{
long N;
while(1)
{
cin>>N;
if(N==0)
break;
long i,j;
long *c=new long[N],*t=new long[N];
for(i=0;i<N;i++)
cin>>c[i];
for(i=0;;i++)
{
for(j=0;j<N;j++)
{
if(c[j]%2==1)
c[j]++;
c[j]/=2;
t[j]=c[j];
}
for(j=0;j<N;j++)
c[(j+1)%N]+=t[j];
for(j=1;j<N;j++)
{
if(c[j]!=c[0])
break;
}
if(j==N)
break;
}
cout<<i<<' '<<c[0]<<endl;
delete [] c,t;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator