No.8114 Prime Checker+1
レベル :
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : / 解いたユーザー数 121
作問者 :
yuusaan
/ テスター :
👑
seekworser
タグ : / 解いたユーザー数 121
作問者 :
問題文最終更新日: 2025-02-21 12:37:41
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
Problem Statement
You are given an integer $N$ greater than or equal to $2$. Choose one of the following two checks and actually perform it.
- Determine whether $N$ is prime.
- Determine whether $N+1$ is prime.
On the first line, print 0 if you perform the former check, or 1 if you perform the latter check.
Then, on the second line, print Yes if the number being checked is prime, and No otherwise.
Input
$N$
Constraints
- $2\le N \le$ $10^{100000}$
- $N$ is an integer.
Output
Print a newline at the end.
Sample
Sample 1
Input
10
Output
1 Yes
$11$, which is $10 + 1$, is prime. You may also choose the former check and determine that $10$ is not prime.
Sample 2
Input
2222222222222222222222222222222222222222222222222222222222222
Output
0 No
Note that $N$ can be extremely large.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。