Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Game of Piles Version 2 codechef solution

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int,input().split()))[:n]
    b = 0
    c = 0
    d = 0
    e = 0
    f = 0
    for i in range(n):
        if arr[i] == 1:
            d += 1
        else:

            if arr[i] == 2:
                c += 1
            e += arr[i]
            f += 1
            if arr[i]%2 != 0:
                b += 1

    if d == 1:
        if b%2 == 0:
            print("CHEF")
            continue
        if c == 0:
            print("CHEFINA")
            continue
        e -= 2
        f -= 1
        if (e-f)%2 != 0:
            print("CHEFINA")
            continue
        else:
            print("CHEF")
            continue
    elif d>1:
        if (e-f)%2 != 0:
            print("CHEF")
            continue
        else:
            print("CHEFINA")
            continue
    if b%2 != 0:
        print("CHEF")
        continue
    else:
        print("CHEFINA")
        continue
Comment

PREVIOUS NEXT
Code Example
Python :: index a dictionary python 
Python :: turn python script into exe 
Python :: open file in python directory 
Python :: string to tuple python 
Python :: mediana python 
Python :: write lines python with line breaks 
Python :: Compute the 2d histogram of x and y. 
Python :: random 2 n program in python 
Python :: seir model python 
Python :: decimal to binary in python 
Python :: string format zero padded int python 
Python :: python read binary trj file 
Python :: django-sslserver 
Python :: pip install django celery results 
Python :: pandas groupby counts 
Python :: python edit string variable 
Python :: how to get the type of numpy array 
Python :: get turtle pos 
Python :: python cholesky 
Python :: get the time of 1 minute later in python 
Python :: py foreach 
Python :: Iterate string 2 characters at a time in python 
Python :: handwriting python 
Python :: sentence similarity spacy 
Python :: remove space from string python 
Python :: how to stop a program after 1 second in python 
Python :: sentiment analysis french python 
Python :: fibonacci 
Python :: how to use a function to find the average in python 
Python :: python check samplerate of mp3 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =