| ||||||||||
| 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 | |||||||||
PASCAL!var
n,l,i,min,min2,j,now:longint;
a:array[1..30000]of longint;
begin
readln(n,l);
min:=maxlongint;
for i:=1 to n do
read(a[i]);
for i:=1 to l do
begin
now:=0;
for j:=1 to n do begin now:=now+a[j] mod l; inc(a[j]); end;
if min>now then begin min:=now; min2:=i; end;
end;
writeln(min2-1);
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator