Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var n,i,kypuru,proverka,nom500,nom100,nom50,nom20,nom10,nom200: integer;
- begin
- read(n);
- proverka:=n mod 10;
- if proverka>0 then writeln(-1) else
- for i:=1 to n do begin
- nom500:=n div 500;
- nom200:=(n-nom500*500) div 200;
- nom100:=(n-nom500*500-nom200*200) div 100;
- nom50:=(n-nom500*500-nom200*200-nom100*100) div 50;
- nom20:=(n-nom500*500-nom200*200-nom100*100-nom50*50) div 20;
- nom10:=(n-nom500*500-nom200*200-nom100*100-nom50*50-nom20*20) div 10;
- end;
- kypuru:=nom500+nom200+nom100+nom50+nom20+nom10;
- writeln(kypuru);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement