Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Delphi by Ivan ( 13 years ago )
program VinniPuh;
{$APPTYPE CONSOLE}
uses
SysUtils;
var a:array[1..10000] of integer;
l:string;
i,n,s,b,f:longint;
q:boolean;
procedure counter(k:longint);
begin
if a[n-k+1] <> 0 then
a[n-k+1]:=a[n-k+1]-1
else
if a[n-k+1] = 0 then
begin
counter(k-1);
a[n-k+1]:=9;
if (a[f] = 0) then
f:=f-1;
end;
if (f = 1) and (a[1] = 0) then
q:=false;
end;
begin
q:=true;
read(l);
n:=length(l);
f:=n;
for i:= n downto 1 do
a[n-i+1]:=strtoint(l[i]);
while q do
begin
read(b);
s:=s+b;
counter(n);
end;
write(s mod 3);
readln;
readln;
{ TODO -oUser -cConsole Main : Insert code here }
end.
Revise this Paste