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 1225. Flags

why WA in 5
Posted by Bazeev Damir`~ 11 Feb 2018 09:57
import math
n=int(input())
ans=2
shag1=2
shag2=0
for i in range(n):
    c=ans-shag1-shag2
    ans+=c
    shag2=shag1
    shag1=c
print(ans)