fork download
  1. var S, K, A, B, N, rez:longint;
  2. begin
  3. readln (S, K, A, B);
  4. if s*a=b then writeln (s*k)
  5. else
  6. begin
  7. n:=1;
  8. while n<1001 do
  9. begin
  10. if (abs(s*a-b)) mod n =0 then
  11. begin
  12. rez:=((b-s*a) div n) +s*k;
  13. if (rez>=0) and (a>n*k) then
  14. begin
  15. writeln (rez);
  16. halt;
  17. end;
  18. end;
  19. inc (n);
  20. end;
  21. if n=1001 then writeln (-1);
  22. end;
  23. end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: 'var' does not name a type
 var S, K, A, B, N, rez:longint;
 ^
prog.cpp:2:1: error: 'begin' does not name a type
 begin
 ^
prog.cpp:4:5: error: expected unqualified-id before 'if'
     if s*a=b then writeln (s*k)
     ^
prog.cpp:8:23: error: expected unqualified-id before 'while'
                       while n<1001 do
                       ^
prog.cpp:13:36: error: expected unqualified-id before 'if'
                                    if (rez>=0) and (a>n*k) then
                                    ^
prog.cpp:16:68: error: 'halt' does not name a type
                                                                    halt;
                                                                    ^
prog.cpp:17:63: error: 'end' does not name a type
                                                               end;
                                                               ^
prog.cpp:18:31: error: 'end' does not name a type
                               end;
                               ^
prog.cpp:19:32: error: expected constructor, destructor, or type conversion before '(' token
                            inc (n);
                                ^
prog.cpp:20:23: error: 'end' does not name a type
                       end;
                       ^
prog.cpp:21:23: error: expected unqualified-id before 'if'
                       if n=1001 then writeln (-1);
                       ^
prog.cpp:22:18: error: 'end' does not name a type
                  end;
                  ^
prog.cpp:23:1: error: 'end' does not name a type
 end.
 ^
stdout
Standard output is empty