-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeThemEqual.cpp
51 lines (48 loc) · 985 Bytes
/
MakeThemEqual.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<bits/stdc++.h>
using namespace std;
int main()
{
int T;
cin>>T;
int N[T];
int A[100][100];
for(int i=0;i<T;i++)
{
for (int c=0;c<N[i];c++)
{
cin>>N[i]>>A[i][c];
}
}
for(int j=0;j<T;j++)
{
int odd=0;
int even=0;
for(int k=0;k<N[j];k++)
{
if(A[j][k]%2==0)
{
even++;
}
else
{
odd++;
}
}
if(odd%2==0)
{
for (int l=0;l<N[j];l++)
{
if(A[j][l]%2!=0)
{
for(int m=l+1;m<N[j];m++)
{
if(A[j][m]%2!=0)
{
A[j][N[j]+1]=A[j][l]+A[j][l+1];
}
}
}
}
}
}
}