Cod sursa(job #43887)
Utilizator | Data | 30 martie 2007 17:05:41 | |
---|---|---|---|
Problema | Next | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.28 kb |
var f,g:text;
n,x,d,m:real;
begin
assign(f,'next.in');
reset(f);
assign(g,'next.out');
rewrite(g);
readln(f,n);
read(f,d);
x:=(d-(n-(n/d-frac(n/d))*d));
if x=d then m:=n
else m:=n+x;
write(g,m:0:0);
close(g);
end.