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

Can any1 help what is wrong here???
Posted by Swifty 18 Mar 2009 18:01
var a:array [1..50] of byte;
    i,n,q:byte;
    ch:char;
    k:longint;
begin
  i:=0;
  while not(eoln) do
    begin
      inc(i);
      read(ch);
      a[i]:=ord(ch)-48;
    end;
  n:=i;
  q:=0;
  for i:=n downto 1 do
    begin
      inc(q);
      if q mod 7=1 then k:=k+(a[i]);
      if q mod 7=2 then k:=k+(a[i]*3);
      if q mod 7=3 then k:=k+(a[i]*2);
      if q mod 7=4 then k:=k+(a[i]*6);
      if q mod 7=5 then k:=k+(a[i]*4);
      if q mod 7=6 then k:=k+(a[i]*5);
    end;
  writeln(k mod 7);
  readln;
end.
WA #2 test...