日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Array with Odd Sum(CF-1296A)

發(fā)布時間:2025/3/17 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Array with Odd Sum(CF-1296A) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

Problem Description

You are given an array a consisting of n integers.

In one move, you can choose two indices 1≤i,j≤n such that i≠j and set ai:=aj. You can perform such moves any number of times (possibly, zero). You can choose different indices in different operations. The operation := is the operation of assignment (i.e. you choose i and j and replace ai with aj).

Your task is to say if it is possible to obtain an array with an odd (not divisible by 2) sum of elements.

You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1≤t≤2000) — the number of test cases.

The next 2t lines describe test cases. The first line of the test case contains one integer n (1≤n≤2000) — the number of elements in a. The second line of the test case contains n integers a1,a2,…,an (1≤ai≤2000), where ai is the i-th element of a.

It is guaranteed that the sum of n over all test cases does not exceed 2000 (∑n≤2000).

Output

For each test case, print the answer on it — "YES" (without quotes) if it is possible to obtain the array with an odd sum of elements, and "NO" otherwise.

Examples

Input

5
2
2 3
4
2 2 8 8
3
3 3 3
4
5 5 5 5
4
1 1 1 1

Output

YES
NO
YES
NO
NO

題意:t 組數(shù)據(jù),每組給出 n 個數(shù),對于任意兩個數(shù) a[i]、a[j],可以令 a[i]=a[j],問在有限次操作的情況下,這 n 個數(shù)的和是否能變成一個奇數(shù)

思路:簡單的思維題,首先,如果這 n 個數(shù)全是偶數(shù),那么一定不可能,然后,如果這 n 個數(shù)都是奇數(shù),且 n 是一個偶數(shù),那么無論怎么變,偶數(shù)個奇數(shù)相加一定是偶數(shù),也不可能,排除上述兩種情況外,其他情況全都可能

Source Program

#include<iostream> #include<cstdio> #include<cstdlib> #include<string> #include<cstring> #include<cmath> #include<ctime> #include<algorithm> #include<utility> #include<stack> #include<queue> #include<vector> #include<set> #include<map> #include<bitset> #define PI acos(-1.0) #define INF 0x3f3f3f3f #define LL long long #define Pair pair<int,int> LL quickPow(LL a,LL b){ LL res=1; while(b){if(b&1)res*=a; a*=a; b>>=1;} return res; } LL multMod(LL a,LL b,LL mod){ a%=mod; b%=mod; LL res=0; while(b){if(b&1)res=(res+a)%mod; a=(a<<=1)%mod; b>>=1; } return res%mod;} LL quickMultPowMod(LL a, LL b,LL mod){ LL res=1,k=a; while(b){if((b&1))res=multMod(res,k,mod)%mod; k=multMod(k,k,mod)%mod; b>>=1;} return res%mod;} LL quickPowMod(LL a,LL b,LL mod){ LL res=1; while(b){if(b&1)res=(a*res)%mod; a=(a*a)%mod; b>>=1; } return res; } LL getInv(LL a,LL mod){ return quickPowMod(a,mod-2,mod); } LL GCD(LL x,LL y){ return !y?x:GCD(y,x%y); } LL LCM(LL x,LL y){ return x/GCD(x,y)*y; } const double EPS = 1E-15; const int MOD = 1000000000+7; const int N = 2000+5; const int dx[] = {0,0,1,-1,1,1,-1,-1}; const int dy[] = {1,-1,0,0,1,-1,1,-1}; using namespace std;int a[N]; int main() {int t;scanf("%d", &t);while (t--) {int n;scanf("%d", &n);int odd = 0, even = 0;for (int i = 1; i <= n; i++) {scanf("%d", &a[i]);if (a[i] % 2)odd++;elseeven++;}if (even == n)printf("NO\n");else {if (n % 2 == 0 && odd == n)printf("NO\n");elseprintf("YES\n");}}return 0; }

?

總結

以上是生活随笔為你收集整理的Array with Odd Sum(CF-1296A)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 九七精品| 三级少妇| 欧美拍拍视频 | 成人av第一页 | 韩国91视频 | 一级黄色片片 | 亚洲一区在线观看视频 | 三级成人| 天天色天天草 | 国产精品九九 | 久久久久久久黄色 | 免费在线观看黄 | 男女操操视频 | 成人一级黄色片 | 精品一区二区三区视频日产 | 丰满少妇乱子伦精品看片 | 国产cao | 张柏芝54张无删码视频 | 色图在线观看 | 日韩黄色片在线观看 | 热久久中文字幕 | 一区在线观看视频 | 日本大尺度激情做爰hd | 欧洲女女同性videoso | 国产九九精品 | 亚洲一区二区免费电影 | 雪白的扔子视频大全在线观看 | www.爱爱.com| 色国产精品 | 欧美一区二区 | 各种含道具高h调教1v1男男 | 手机av在线不卡 | 精久久久久久久 | 激情偷乱人成视频在线观看 | 日日噜噜噜夜夜爽爽狠狠 | 日本亚洲色图 | 在线观看欧美亚洲 | 秋霞成人 | 久久99精品国产.久久久久 | 中文在线免费视频 | 天天看天天操 | 黄色二级视频 | av国产片 | 日韩欧美的一区二区 | 韩日视频 | 日韩在线播放视频 | 天堂在线一区 | 玩弄人妻少妇500系列视频 | 一区二区三区日韩欧美 | 成人爽a毛片一区二区免费 日本高清免费看 | 草久久免费视频 | 淫羞阁av导航 | 国产黄色在线播放 | 久久久久久久999 | 日韩一区二区a片免费观看 伊人网综合在线 | 日韩一区二区三区不卡 | 久久美女av | 熟女高潮一区二区三区视频 | 在线观看av网站 | 992tv成人免费视频 | 欧洲中文字幕日韩精品成人 | 97精品国产97久久久久久粉红 | 青青青青青草 | 欧美精品久 | 日韩一区免费观看 | 国产成人精品一区二区色戒 | 国内视频自拍 | 亚洲黄在线| 国产成人av在线 | 亚洲欧美bt| 午夜精品久久久久久久四虎美女版 | 性猛交ⅹxxx富婆视频 | 精品少妇视频 | 国产一级淫片a视频免费观看 | 麻豆自拍偷拍 | 五月婷婷综合久久 | 秋霞欧美一区二区三区视频免费 | 日韩六十路| 成人高清 | 免费在线不卡视频 | 色婷婷九月 | 日本国产三级xxxxxx | 欧美日韩一二三四 | 免费av在线播放 | 国产高清在线免费观看 | 国产男女猛烈无遮挡免费视频 | 欧美作爱视频 | 久久免费激情视频 | 国产亚洲精品一区二区三区 | 无码精品一区二区三区AV | 一区二区在线 | 成人免费三级 | 国产在线色 | 精品久久久久久久久久久aⅴ | 国产一区二区视频播放 | 波多野结衣毛片 | 精品人妻伦一二三区久久 | 999av| 久久久久精 |