QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#788514#9225. Fibonacci Fusionucup-team2179#RE 7ms10604kbPython3434b2024-11-27 17:15:392024-11-27 17:15:39

Judging History

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

  • [2024-11-27 17:15:39]
  • 评测
  • 测评结果:RE
  • 用时:7ms
  • 内存:10604kb
  • [2024-11-27 17:15:39]
  • 提交

answer

base = 131
mod = 1e18 +21
def hash(x):
	res = 0
	while (x):
		res = (res * base + x % 10)
		x //= 10
	return res
n = int(input())
arr = []
for i in range(n):
	x = int(input())
	arr.append(x)
arr.sort()
fib1 = 1
fib2 = 1
ans = 0
dict = {}
for x in arr:
	while fib2 <= x:
		fib2 = fib1 + fib2
		fib1 = fib2 - fib1
	val = dict.get(hash(fib2 - x))
	if (val != None):
		ans = ans + 1
	dict[hash(x)] = 1
print(ans)

詳細信息

Test #1:

score: 100
Accepted
time: 7ms
memory: 10604kb

input:

6
50
8
8
5
72
354224848179261915070

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: -100
Dangerous Syscalls

input:

28
200878223506436882933619847964496455022155117513398820563747455993172799881403389571477889821109288771413214004090719097929400406252135763028179112130390003528046316900603668569910008417315162907579003880220844686222148696041857432602133894827753998572080650383305777912447151917272483538029469449...

output:


result: