五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(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ó)家法律
大同县| 德格县| 伊金霍洛旗| 东至县| 繁昌县| 巨野县| 宜川县| 措勤县| 绥江县| 大渡口区| 武宣县| 桂林市| 浦北县| 冷水江市| 固始县| 星子县| 孝昌县| 鄱阳县| 隆回县| 江都市| 尼玛县| 随州市| 江陵县| 逊克县| 杨浦区| 平乐县| 遂昌县| 金坛市| 安图县| 敖汉旗| 筠连县| 奈曼旗| 会同县| 乌兰浩特市| 新宾| 南靖县| 黑山县| 从江县| 旌德县| 栾城县| 浮梁县|