无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

CF 1857A - Array Coloring

2023-08-11 09:17 作者:您是打尖兒還是住店呢  | 我要投稿

You are given an array consisting of n integers. Your task is to determine whether it is possible to color all its elements in two colors in such a way that the sums of the elements of both colors have the same parity and each color has at least one element colored.

For example, if the array is [1,2,4,3,2,3,5,4], we can color it as follows: [1,2,4,3,2,3,5,4], where the sum of the blue elements is 6 and the sum of the red elements is 18.

Input

The first line contains an integer t (1≤t≤1000) — the number of test cases.

Each test case begins with a line containing an integer n (2≤n≤50) — the length of the array a.

The next line contains n integers a1,a2,…,an (1≤ai≤50) — the elements of the array a.


Output

For each test case, output "YES" (without quotes) if it is possible to color the array in two colors in such a way that the sums of the elements of both colors have the same parity and each color has at least one element colored, and "NO" otherwise.


You can output "Yes" and "No" in any case (for example, the strings "yES", "yes", and "Yes" will be recognized as correct answers).

---------------------------------------------------------

給定一個(gè)由 n 個(gè)整數(shù)組成的數(shù)組。 您的任務(wù)是確定是否可以將其所有元素著色為兩種顏色,使得兩種顏色的元素之和具有相同的奇偶性,并且每種顏色至少有一個(gè)元素著色。

例如,如果數(shù)組是[1,2,4,3,2,3,5,4],我們可以將其著色如下:[1,2,4,3,2,3,5,4], 其中藍(lán)色元素的總和為 6,紅色元素的總和為 18。

輸入

第一行包含一個(gè)整數(shù) t (1≤t≤1000) — 測(cè)試用例的數(shù)量。

每個(gè)測(cè)試用例都以包含整數(shù) n (2≤n≤50) 的行開(kāi)始 — 數(shù)組 a 的長(zhǎng)度。

下一行包含 n 個(gè)整數(shù) a1,a2,…,an (1≤ai≤50) — 數(shù)組 a 的元素。


輸出

對(duì)于每個(gè)測(cè)試用例,如果可以用兩種顏色對(duì)數(shù)組進(jìn)行著色,使得兩種顏色的元素之和具有相同的奇偶性,并且每種顏色至少有一個(gè)元素著色,則輸出“YES”(不帶引號(hào)) ,否則為“否”。


您可以在任何情況下輸出“Yes”和“No”(例如,字符串“yES”、“yes”和“Yes”將被識(shí)別為正確答案)。

---------------------------------

題意轉(zhuǎn)換,只要和是偶數(shù),那么就可以組成,反之不可以;

下面是代碼:


CF 1857A - Array Coloring的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
宜丰县| 望谟县| 兴安盟| 青铜峡市| 江华| 黎城县| 广元市| 烟台市| 思茅市| 花垣县| 合山市| 白河县| 安泽县| 沾益县| 肥东县| 弋阳县| 依兰县| 拉萨市| 中阳县| 大化| 宝鸡市| 乐都县| 泸州市| 潞城市| 台湾省| 博客| 高淳县| 钟祥市| 黄冈市| 邹城市| 肥城市| 上饶县| 崇州市| 疏附县| 涞源县| 晋城| 万盛区| 浦北县| 天台县| 长乐市| 方山县|