QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#686158#8340. 3 SumMaxDYFCompile Error//C++23395b2024-10-29 02:18:022024-10-29 02:18:03

Judging History

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

  • [2024-10-29 02:18:03]
  • 评测
  • [2024-10-29 02:18:02]
  • 提交

answer

n, k = map(int, input().split())
mod = (10**k) - 1
a = []
s = dict()
for i in range(n):
    a.append(int(input()) % mod)

for i in range(n):
    for j in range(i, n):
        x = a[i]
        y = a[j]
        s[(x + y) % mod] = s.get((x + y) % mod, 0) + 1
ans = 0
for x in a:
    ans += s.get(mod - x, 0)
for x in a:
    if ((x + x + x) % mod == 0):
        ans -= 1
print(ans)

詳細信息

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