FanaticExplorer

eolymp_6

Oct 27th, 2021 (edited)
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.42 KB | None | 0 0
  1. var n,i,one,two,three, four, five,sum:longint;
  2. is_any:Boolean;
  3. begin
  4.     is_any:=False;
  5.     readln(n);
  6.     for i:=1 to 100000 do
  7.     begin
  8.         if i=10000 then one:=1;
  9.         two:=(i div 1000) mod 10;
  10.         three:=(i div 100) mod 10;
  11.         four:=(i mod 100) div 10;
  12.         five:=i mod 10;
  13.         sum:=(one+two+three+four+five);
  14.         if ((sum*n)=i) then
  15.         begin
  16.             writeln(i);
  17.             is_any:=True;
  18.             break;
  19.         end;
  20.     end;
  21.     if not is_any then writeln(0);
  22. end.
Add Comment
Please, Sign In to add comment