Startup and Tech
Tuesday, 21 July 2020
Codeforces 1382B - Sequential Nim Problem Solution In Python
Program
t = int(input()) for i in range(t): n = int(input()) a = [int(j) for j in input().split()[:n]] x=0 p=-1 for j in range(n): if(a[j]>1): p = j break x+=1 if(p!=-1): if(p%2==0): print('First') else: print('Second') else: if(n%2==0 and x==n): print('Second') elif(n%2!=0 and x==n): print('First')
Output
I/P : 7 3 2 5 4 8 1 1 1 1 1 1 1 1 6 1 2 3 4 5 6 6 1 1 2 1 2 2 1 1000000000 5 1 2 2 1 1 3 1 1 1 O/P: First Second Second First First Second First
Codeforces 1324B - Yet Another Palindrome Problem Solution In Python
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment