ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1243. Divorce of the Seven Dwarfs

AC program here
Posted by Ilia S. Chm (Spb SU) 4 Mar 2003 01:05
var a: array [1..239] of byte;
str: string;
i,n: longint;

begin
 readln(str);
 n:=length(str);
 for i:=1 to n do a[i]:=ord(str[i])-ord('0');
 if n=1 then writeln(a[1] mod 7 ) else begin
  i:=1;
  while i<=n-1 do begin
   a[i+1]:=(a[i]*10+a[i+1]) mod 7;
   inc(i);
  end;
  writeln(a[n]);
 end;
end.