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 |
Re:请高手指点,两种不同的方法,不同的结果,都是AC的代码In Reply To:请高手指点,两种不同的方法,不同的结果,都是AC的代码 Posted by:swpujch at 2007-10-21 16:45:05 #include<iostream> using namespace std; int s[30000]; int main(void) { int n,l,i,j; while(scanf("%d%d",&n,&l)==2) { for(i=0;i<n;i++) scanf("%d",s+i); int min,sum; min=0x7fffffff; sum=0; for(i=0;i<=l;i++) { for(j=0;j<n;j++) s[j]++,sum=sum+s[j]%l; if(sum==0) { min=sum; break; } if(sum<min) min=sum; } printf("%d\n",min); } return 0; } 偶头脑晕晕的写出来的,WA了n次 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator