目前做了5道:
from random import randint as ran
def solve1():
score = []
for i in range(50):
score.append(ran(0, 100))
for i in range(50):
print(f"{i + 1} 号同学 {score[i]}")
def solve2():
score = []
for i in range(50):
score.append([ran(0, 100), ran(0, 100), ran(0, 100)])
def cmp(a, b):
if a[0] + a[1] + a[2] != b[0] + b[1] + b[2]:
return a[0] + a[1] + a[2] < b[0] + b[1] + b[2]
if a[0] != b[0]:
return a[1] > b[1]
for i in range(0, 50):
for j in range(i, 50):
if cmp(score[i], score[j]):
score[i], score[j] = score[j], score[i];
print(score)
def solve3():
s = input().split()
s = list(map(lambda s : len(s) != 0, s))
print(len(s))
def solve4():
n = int(input())
cnt_one = 0
for i in range(1, n + 1):
tmp = i
while tmp != 0:
if tmp % 10 == 1:
cnt_one += 1
tmp //= 10
print(cnt_one)
def solve5():
n = int(input())
k = int(input())
people = []
for i in range(n):
people.append(i + 1)
c = 0
pos = 0
while c != n:
for i in range(k):
pos += 1
pos %= (n - c)
print(people[pos - 1])
people.remove(people[pos - 1])
c += 1
pos -= 1
|