| ||||||||||
| 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 | |||||||||
O(n)In Reply To:求O(n)的算法 Posted by:Snow_storm at 2010-03-20 15:28:08 #include <iostream>
using namespace std;
int main()
{
int n,l,t,max=0,i;
cin>>n>>l;
for(i=0;i<n;i++){
cin>>t;
if(t%l&&l-t%l>max) max=l-t%l;
}
cout<<max<<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