QOJ.ac

QOJ

Límite de tiempo: 4.0 s Límite de memoria: 1024 MB Puntuación total: 100

#9225. 斐波那契融合

Estadísticas

斐波那契数列定义为 $0, 1, 1, 2, 3, 5, 8, 13, 21, \dots$ ——其中每个数(前两个数除外)都是前两个数之和。

给定 $N$ 个数 $a_i$,请统计满足 $i < j$ 且 $a_i + a_j$ 为斐波那契数的数对个数。

输入格式

第一行包含一个整数 $N$ ($1 \le N \le 200\,000$)。

接下来 $N$ 行,每行包含一个整数 $a_i$ ($1 \le a_i < 10^{2\,000\,000}$)。这些数字的总位数不超过 $5\,000\,000$。

输出格式

输出一个整数,表示和为斐波那契数的数对个数。

样例

样例输入 1

6
50
8
8
5
72
354224848179261915070

样例输出 1

4

说明

共有 4 对满足条件的数对:

  • $a_2 + a_4 = 8 + 5 = 13$
  • $a_3 + a_4 = 8 + 5 = 13$
  • $a_1 + a_4 = 50 + 5 = 55$
  • $a_4 + a_6 = 5 + 354224848179261915070 = 354224848179261915075$

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.