#Python code for 7169. Pizza Problem code: EGYPIZZA
import math
m=0
n=0
k=0
test=input()
i=0
while i!=test:
a=raw_input()
if len(a)!=0:
if a=="3/4":
m=m+1
if a=="1/2":
n=n+1
if a=="1/4":
k=k+1
i=i+1
if m>=k:
ans=math.ceil(m+n/2.0)
elif m<k:
k=k-m
if n%2==0:
ans = math.ceil(m+n/2.0+k/4.0)
else:
k=k-2
ans= math.ceil(m + n/2.0 + k/4.0)
print int(ans+1)
import math
m=0
n=0
k=0
test=input()
i=0
while i!=test:
a=raw_input()
if len(a)!=0:
if a=="3/4":
m=m+1
if a=="1/2":
n=n+1
if a=="1/4":
k=k+1
i=i+1
if m>=k:
ans=math.ceil(m+n/2.0)
elif m<k:
k=k-m
if n%2==0:
ans = math.ceil(m+n/2.0+k/4.0)
else:
k=k-2
ans= math.ceil(m + n/2.0 + k/4.0)
print int(ans+1)
No comments:
Post a Comment