CF水题四道

深夜无聊,cf上刷水题练python...

结果发现是被练好么...

  1A


#!/usr/bin/env python  

import math	

n, m, a = map(int, raw_input().split())
print int(math.ceil(n*1.0/a)*math.ceil(m*1.0/a))

  158A


1、我是这样写的

#!/usr/bin/env python  

n, k = map(int, raw_input().split())
a = [int(x) for x in raw_input().split()]
for i in range(1, n+1):
	score = a[i-1]
	if score <= 0:
		i -= 1
		break
	if i == k:
		bound = score
	elif i > k:
		if score < bound:
			i -= 1
			break
print i

2、结果发现大神是这样写的

r = lambda: map(int, raw_input().split())
n, k = r()
a = r()
print sum(v >= max(1, a[k-1]) for v in a)

  4A


#!/usr/bin/env python
a = input()
print "NO" if a<4 or a&1 else "YES"

  158B


#!/usr/bin/env python

r = lambda: map(int, raw_input().split())
a = [0]*5
r()
for i in r():
	a[i] += 1
print a[4]+a[3]+(a[2]+1)/2+max(0,(a[1]-a[3]-(a[2]&1)*2+3)/4)


阅读更多
换一批

没有更多推荐了,返回首页