QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#324339#4274. $2x + 2$ToboCompile Error//C++20161b2024-02-10 17:55:032024-02-10 17:55:10

Judging History

你现在查看的是最新测评结果

  • [2024-02-10 17:55:10]
  • 评测
  • [2024-02-10 17:55:03]
  • 提交

answer

n = int(input())
n += 2
ans = -1
i = 1
while n > 0:
    if i % 2 == 1:
        ans += n
    else:
        ans -= n
    i += 1
    n //= 2
print(ans)

Details

answer.code:1:1: error: ‘n’ does not name a type
    1 | n = int(input())
      | ^