QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#544126#4274. $2x + 2$kuaiqujuanCompile Error//C++14122b2024-09-02 09:58:062024-09-02 09:58:06

Judging History

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

  • [2024-09-02 09:58:06]
  • 评测
  • [2024-09-02 09:58:06]
  • 提交

answer

n = int(input())
n += 2
ans = -1
coef = 1
while n > 0 :
    ans += n * coef
    n //= 2
    coef *= -1;
print(ans)

詳細信息

answer.code:1:1: error: ‘n’ does not name a type
    1 | n = int(input())
      | ^
answer.code:9:6: error: expected constructor, destructor, or type conversion before ‘(’ token
    9 | print(ans)
      |      ^