Current work
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
7
|
||||
GHHHGHH
|
||||
HHGGGHH
|
||||
@@ -0,0 +1,22 @@
|
||||
# Farmer John orders N cows, of two breeds
|
||||
# H for Holstein or G for Guernsey
|
||||
|
||||
# A string is the breed identifiers John originally wanted
|
||||
# B string is the string when the cows arrive
|
||||
|
||||
read = open("breedflip.in")
|
||||
n = int(read.readline())
|
||||
|
||||
A = read.readline()
|
||||
B = read.readline()
|
||||
|
||||
cnt = 0
|
||||
res = 0
|
||||
for i in range(n):
|
||||
if A[i] != B[i]:
|
||||
cnt += 1
|
||||
elif cnt != 0:
|
||||
cnt = 0
|
||||
res += 1
|
||||
|
||||
print(res, file=open("breedflip.out", "w"))
|
||||
Reference in New Issue
Block a user