第一题[编程题25分]: 闹钟叫醒去上课
n = int(input())
a = []
b = []
for i in range(n):
A, B = map(int, input().split())
a.append(A)
b.append(B)
X = int(input())
A, B = map(int, input().split())
flag = A * 60 + B
temp = []
for i in range(n):
temp.append(a[i]*60 + b[i]+X)
res = 0
for i in range(0, n):
if temp[i] <= flag:
if temp[res] < temp[i]:
res = i
print(str(a[res]) + ' ' + str(b[res]))
第二题[编程题25分]: 秘密通信
# A ^ A = 0 A ^ 0 = A A ^ 1 = ~A A ^ B ^ B = A
N, K = map(int, input().split())
S = list(map(int, input()))
B = N * [0]
B[0] = S[0]
B[-1] = S[-1]
for i in range(1, K):
B[i] = S[i] ^ S[i-1]
for i in range(-2, -1-K, -1):
B[i] = S[i] ^ S[i+1]
if 2 * K < N:
for i in range(K, N-K):
B[i] = S[i] ^ S[i-1] ^ B[i-K]
print(''.join(map(str, B)))
第三题[编程题25分]: 万万没想到之抠门的老板
N = int(input())
S = list(map(int, input().split()))
M = N * [100]
for i in range(N):
if i-1 >= 0 and S[i] > S[i-1]:
if M[i] <= M[i-1]:
M[i] = M[i-1]+100
print(M)
for i in range(-2, -N-1, -1):
if S[i] > S[i+1]:
if M[i] <= M[i+1]:
M[i] = M[i+1]+100
res = 0
for i in range(N):
res += M[i]
print(M)
print(res)
#字节跳动##笔试题目##秋招##算法工程师##笔经#