| ||||||||||
| 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 | |||||||||
不要逼我打表var
k,m : longint;
function ok(m : longint) : boolean;
var i,j,n,l : longint;
begin
ok := false;
j := 0; n := k*2;
for i := 1 to k do begin
l := (j+m-1) mod n;
if l < k then exit;
n := n-1;
j := l mod n;
end;
ok := true;
end;
begin
readln(k);
while(k<>0)do
begin
m := k+1;
while not ok(m) do m := m+1;
writeln(m);
readln(k);
end;
end.
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator