QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#973. 合成数列

Statistics

正の整数の列 $S$ が「合成数列 (composite sequence)」であるとは、その空でない部分列 $T$ であって、$T$ に含まれるすべての整数の和が合成数となるものが存在することを指す。

$S$ が与えられるので、$S$ が合成数列であるかどうかを判定せよ。

$1$ は合成数ではないことに注意せよ。

$T$ が $S$ の部分列であるとは、$S$ からいくつかの要素(0個またはすべてでもよい)を取り除くことで $T$ が得られることを指す。

入力

入力は以下の形式で与えられる。

$n$ $S_1, S_2, \dots, S_n$

1行目には、$S$ のサイズを表す整数 $n$ ($1 \le n \le 10^5$) が与えられる。 2行目には、$S$ の要素を表す $n$ 個の整数 $S_1, S_2, \dots, S_n$ ($1 \le S_i \le 10^9$) が与えられる。

出力

$S$ が合成数列であれば "Yes" と出力せよ。そうでなければ "No" と出力せよ。

入出力例

入力 1

2
5 7

出力 1

Yes

入力 2

1
97

出力 2

No

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.