1582A - Luntik and Concerts - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

t=int(input())
for i in range(t):
    a=list(map(int,input().split()))
    x=a[0]
    y=a[1]
    z=a[2]
    ans=1
    if(((((x%2==0)and(y%2==0))and(z%2==0))or(((x%2==0)and(y%2==1))and(z%2==0)))or((((x%2==1)and(y%2==1))and(z%2==1))or(((x%2==1)and(y%2==0))and(z%2==1)))):
        ans=0
    print(ans)

C++ Code:

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <unordered_map>
#include <cmath>
using namespace std;

int main()
{

    int tc;
    cin >> tc;

    while (tc--)
    {
        int a, b, c;
        cin>>a>>b>>c;
        int total = a + b*2 + c*3;
        if(total%2 == 0)
        {   
            cout<<0<<endl;
        }
        else
        {
            cout<<1<<endl;
        }

    }
}

// 1 9 1

// 11, 11      2x+1  



// x 2y 3z   a-x  2b-2y   3c-3z

// 2x 4y 6z - a - 2b - 3c


// (x+2y+3z) = n/2


Comments

Submit
0 Comments
More Questions

1692B - All Distinct
1156C - Match Points
1675A - Food for Animals
1328C - Ternary XOR
1689A - Lex String
1708B - Difference of GCDs
863A - Quasi-palindrome
1478A - Nezzar and Colorful Balls
1581B - Diameter of Graph
404A - Valera and X
908A - New Year and Counting Cards
146A - Lucky Ticket
1594C - Make Them Equal
1676A - Lucky
1700B - Palindromic Numbers
702C - Cellular Network
1672C - Unequal Array
1706C - Qpwoeirut And The City
1697A - Parkway Walk
1505B - DMCA
478B - Random Teams
1705C - Mark and His Unfinished Essay
1401C - Mere Array
1613B - Absent Remainder
1536B - Prinzessin der Verurteilung
1699B - Almost Ternary Matrix
1545A - AquaMoon and Strange Sort
538B - Quasi Binary
424A - Squats
1703A - YES or YES