10
4
2018
0

[UOJ15] 【NOIP2014】生活大爆炸版石头剪刀布

练一下python

以下代码在python2.7编译通过

这个题直接做,循环就可以了

win=[[1, 0, 2, 2, 0], [2, 1, 0, 2, 0], [0, 2, 1, 0, 2], [0, 0, 2, 1, 2], [2, 2, 0, 0, 1]]
xiaoa=[]; xiaob=[]; wina=0; winb=0
n, na, nb=map(int, raw_input().split())
#print n, na, nb
p=raw_input().split()
for i in range(0, na):
    xiaoa.append(int(p[i]))
p=raw_input().split()
for i in range(0, nb):
    xiaob.append(int(p[i]))
for i in range(0, n):
    px=win[int(xiaoa[i%na])][int(xiaob[i%nb])]
    if px==0:
        winb+=1
    elif px==2:
        wina+=1
print wina, winb
Category: 其他OJ | Tags: uoj

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com