QOJ.ac

QOJ

Limite de temps : 1.0 s Limite de mémoire : 512 MB Points totaux : 100 Hackable ✓

#7526. 信用卡

Statistiques

Obtuse Bank 是第一家为 VIP 客户发行钝角三角形形状信用卡的银行。

由于银行对 VIP 客户的个性化服务,三角形所有边的长度均为 $[1, n]$ 范围内的唯一整数,即配置工具的工作方式如下:

最初,池中包含 $1$ 到 $n$ 之间 $n$ 个两两不同的整数。配置工具允许从当前池中选择任意三个整数,使得以这三个长度为边长的三角形是钝角三角形(即其中一个角严格大于 $90$ 度且小于 $180$ 度),然后生成信用卡,并将这些整数从当前池中移除。

请为给定的 $n$ 找出配置工具所能生成的钝角三角形的最大数量。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^6$),表示配置工具中可用的不同整数的数量。

输出格式

第一行输出一个整数 $t$ ($0 \le 3 \cdot t \le n$),表示钝角三角形的最大数量。

接下来的 $t$ 行,每行包含三个用空格分隔的整数 $a_i, b_i, c_i$ ($1 \le a_i, b_i, c_i \le n$),表示第 $i$ 个三角形的边长。

如果存在多种可能的解,输出其中任意一种即可。

样例

样例输入 1

3

样例输出 1

0

样例输入 2

4

样例输出 2

1
2 3 4

样例输入 3

9

样例输出 3

2
2 3 4
6 5 9

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.