No.689 E869120 and Constructing Array 3
レベル :
/ AI推定難易度 : 1300
/ 実行時間制限 : 1ケース 1.000秒 / メモリ制限
: 256 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : / 解いたユーザー数 102
作問者 :
e869120
/ テスター :
square1001
タグ : / 解いたユーザー数 102
作問者 :
e869120
/ テスター :
問題文最終更新日: 2026-06-28 15:36:33
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 191
(順位表)
の他の問題:
Problem Statement
Construct a sequence $c$ as follows.
- Let $N$ be the length of the sequence, and let $c_i$ be the $i$-th value of the sequence.
- Among all $(i, j)$ satisfying $1 \leq i < j \leq N$, the number of those for which $c_i+c_j$ is prime is $K$.
- $1 \leq N \leq 250$ must be satisfied.
- $1 \leq c_i \leq 1 \ 000 \ 000$ must be satisfied.
Input
K
On line $1$, an integer $K$ between $0$ and $10000$, inclusive, is given.
Output
$N$ $c_1$ $c_2$ ... $c_N$
On line $1$, print the length $N$ of the sequence $c$.
On line $2$, print the values $c_i$ of the sequence, separated by spaces.
Print a newline at the end.
Sample
Sample 1
Input
2
Output
4 3 4 5 6
- $3+4$ is prime.
- $5+6$ is prime.
- No other pair $(i, j)$ gives a prime.
Sample 2
Input
9
Output
6 1 1 4 5 1 4
$c_i+c_j$ is prime for a total of $9$ pairs $(i, j)$.
Sample 3
Input
6
Output
5 1 2 3 4 5
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。