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呢。。。疯了。。大家帮忙看下,感激不尽#include<iostream> using namespace std; int main() { int l,n; int a[30002]; while(cin>>n>>l) { int i; int sum=0; for(i=0;i<n;i++){ cin>>a[i]; sum+=a[i]%l; } if(sum==0){ cout<<sum<<endl; continue; } int j; sum=0; int min=999999999; for(j=0;j<=l;j++) { for(i=0;i<n;i++){ a[i]++; sum+=a[i]%l; } if(sum==0) break; if(sum<min) min=sum; } cout<<min<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator