| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 97 | 72 | 68 | 74.725% |
In a distant Mathematical Kingdom, there stands an ancient gate known as the “Twin Gate.” Legend has it that the gate will only open when two “Twin Guardians” stand before it at the same time.
The king has summoned a wise adventurer to help determine whether the two given numbers are “Twin Primes.” If they genuinely are Twin Guardians (i.e., Twin Primes), the gate will shine brightly and open; otherwise, it will remain firmly shut.
Definition of Twin Primes: If two numbers $i$ and $i+2$ are both prime, they are called “twin primes.”
Each test contains multiple test cases. The first line contains the number of test cases $t$. The description of the test cases follows.
The only line of each test case contains two integers $a$ and $b,ドル representing a task assigned by the king that asks you to check these two numbers.
For each test case, if $a$ and $b$ are twin primes, output Y (indicating “Yes, the Twin Gate opens!”); otherwise, output N.
5 2 3 11 13 12 14 3 5 5 7
N Y N Y Y
5 17 19 29 31 15 17 19 21 41 43
Y Y N N Y
ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2025 B번