Guest User

Untitled

a guest
Oct 17th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. {$R+}
  2. label metka;
  3. var x,i,y,z:integer; s:string;
  4. a: array [0..256] of longint;
  5. f: array [0..256] of longint;
  6. g: array [0..256] of longint;
  7. begin
  8. assign(input, 'input.txt'); reset(input);
  9. assign(output, 'output.txt'); rewrite(output);
  10. readln(s);
  11. for i:=1 to 256 do a[i]:=0;
  12. for i:=1 to 256 do f[i]:=0;
  13. for i:=1 to 256 do g[i]:=0;
  14. a[0]:=length(s);
  15. for i:=1 to a[0] do a[i]:=ord(s[length(s)-i+1])-48;
  16. readln(s);
  17. for i:=1 to 256 do f[i]:=0;
  18. f[0]:=length(s);
  19. for i:=1 to f[0] do f[i]:=ord(s[length(s)-i+1])-48;
  20. if a[0]>f[0] then z:=a[0]
  21. else z:=f[0];
  22. for i:=1 to z do begin
  23. y:=a[i]+f[i]+g[i];
  24. g[i]:=y mod 10;
  25. g[i+1]:=y div 10;
  26. end;
  27. i:=256;
  28. while g[i]=0 do begin
  29. i:=i-1;
  30. if i=0 then begin i:=1; goto metka; end;
  31. end;
  32. metka : for y:=i downto 1 do
  33. write(g[y]);
  34.  
  35. end.
Add Comment
Please, Sign In to add comment