参考代码:
def generate(x, y): flag = True while flag: for i in range(len(x)): if len(y) < N: y.append(x[i]) else: flag = False N, NA, NB = map(int, input().split()) arrA, arr1 = list(map(int, input().split())), [] arrB, arr2 = list(map(int, input().split())), [] sumA, sumB = 0, 0 generate(arrA,arr1) generate(arrB,arr2) for i in range(N): if arr1[i] == arr2[i]: continue elif arr1[i] == 2 and arr2[i] == 5 or arr1[i] == 0 and arr2[i] == 2 or arr1[i] == 5 and arr2[i] == 0: sumA += 1 elif arr1[i] == 2 and arr2[i] == 0 or arr1[i] == 0 and arr2[i] == 5 or arr1[i] == 5 and arr2[i] == 2: sumB += 1 if sumA > sumB: print('A') elif sumA < sumB: print('B') else: print('draw')
0.0分
0 人评分
C语言训练-自守数问题 (C语言代码) long long浏览:1105 |
2004年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:488 |
2005年春浙江省计算机等级考试二级C 编程题(3) (C语言代码)浏览:417 |
C语言程序设计教程(第三版)课后习题8.5 (C语言代码)浏览:610 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:543 |
简单的a+b (C语言代码)浏览:641 |
剪刀石头布 (C语言代码)浏览:1792 |
Cylinder (C语言描述+详细分析)浏览:3374 |
1012题解浏览:938 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:493 |