Skip to content

Commit

Permalink
Keteki Quick Match 8
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypotter0 committed Mar 12, 2018
1 parent 4f4f6cf commit 3010074
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
26 changes: 26 additions & 0 deletions CP/Keteki Quick Match 8/p1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import math
def readInts():
return list(map(int, raw_input().strip().split()))
def readInt():
return int(raw_input())
def readIntsindex0():
return list(map(lambda x: int(x) - 1, input().split()))
def readStrs():
return raw_input().split()
def readStr():
return raw_input()


for __ in range(readInt()):
n = readInt()
print n//2


'''
Input:
1
4
output:
2
'''
41 changes: 41 additions & 0 deletions CP/Keteki Quick Match 8/p2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import math
def readInts():
return list(map(int, raw_input().strip().split()))
def readInt():
return int(raw_input())
def readIntsindex0():
return list(map(lambda x: int(x) - 1, input().split()))
def readStrs():
return raw_input().split()
def readStr():
return raw_input()

for __ in range(readInt()):
x,y=readInts()
a=[]
for i in range(x):
a.append(readInts())
first=second=0
for i in range(x):
for j in range(y):
if((i+j)%2 == a[i][j]%2):
first+=1
else:
second+=1
print(min(first//2,second//2))
# print(first,second)

'''
Example input:
2
1 2
3 2
3 3
1 0 1
1 0 0
1 0 1
Example output:
0
1
'''

0 comments on commit 3010074

Please sign in to comment.