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 1295. Crazy Notions

WA 7 why?
Posted by zslwyuan 13 Feb 2010 17:07
var
 sum,ans,a,b,c,a1,b1,c1,n:longint;
 i,j:longint;
begin
 readln(n);
 sum:=1;ans:=0;a:=2;b:=3;c:=4;a1:=1;b1:=1;c1:=1;
 for i:=1 to n do
  begin
   a1:=a1*a;
   a1:=a1 mod 1000;
   b1:=b1*b;
   b1:=b1 mod 1000;
   c1:=c1*c;
   c1:=c1 mod 1000;
  end;
 sum:=sum+a1+b1+c1;
 while sum<>0 do
  begin
   if sum mod 10=0 then inc(ans);
   sum:=sum div 10;
  end;
 writeln(ans);
end.