Skip to content

Instantly share code, notes, and snippets.

@02015678
Created January 23, 2015 13:15
Show Gist options
  • Save 02015678/a59a7cb90124eede9f86 to your computer and use it in GitHub Desktop.
Save 02015678/a59a7cb90124eede9f86 to your computer and use it in GitHub Desktop.
02015678's Solution for NK1009 NKPC2 Lucy's Problem
Var
s1,s2,s3,s4:string;
n1,n2,n3:longint;
ch:char;
code,n,i,j:integer;
num:array[1..12] OF 0..9;
Begin
s1:='';s2:='';s3:='';s4:='';
fillchar(num,sizeof(num),0);
repeat
read(ch);
s1:=s1+ch;
until ch=' ';
delete(s1,length(s1),1);
repeat
read(ch);
s2:=s2+ch;
until eoln;
while s1[length(s1)]='0' do delete(s1,length(s1),1);
while s2[length(s2)]='0' do delete(s2,length(s2),1);
For i:=length(s1) downto 1 do s3:=s3+s1[i];
For i:=length(s2) downto 1 do s4:=s4+s2[i];
val(s3,n1,code); val(s4,n2,code);
n3:=n1+n2;
n:=0;
Repeat
inc(n);
num[n]:=n3 mod 10;
n3:=n3 div 10;
Until n3=0;
i:=1;
While num[i]=0 do inc(i);
For j:=i to n do write(num[j]);
writeln;
End.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment