五月天青色头像情侣网名,国产亚洲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ó)家法律
樟树市| 威海市| 江陵县| 平江县| 冀州市| 衡水市| 宝应县| 闽侯县| 明光市| 新建县| 兴国县| 梅州市| 龙州县| 广宁县| 茶陵县| 高密市| 上栗县| 漳浦县| 绥芬河市| 奈曼旗| 扎兰屯市| 静海县| 库尔勒市| 方山县| 阿瓦提县| 南江县| 渝北区| 博爱县| 化德县| 堆龙德庆县| 钟祥市| 河曲县| 宜兰县| 陆丰市| 从江县| 利辛县| 台南市| 上蔡县| 奎屯市| 文登市| 湘阴县|