8.23腾讯笔试(python)第二第三求助
第二题
while True:
try:
T = int(input())
for _ in range(T):
A, B, C, D = map(int, input().split())
tmp_d = A / 3 * (D ** 3) + 0.5 * (D * D) + B * D
tmp_c = A / 3 * (C ** 3) + 0.5 * (C * C) + B * C
print(round(tmp_d - tmp_c, 6))
except:
break
第三题:
try:
T = int(input())
for _ in range(T):
A, B, C, D = map(int, input().split())
tmp_d = A / 3 * (D ** 3) + 0.5 * (D * D) + B * D
tmp_c = A / 3 * (C ** 3) + 0.5 * (C * C) + B * C
print(round(tmp_d - tmp_c, 6))
except:
break
第三题:
while True:
try:
try:
n = int(input())
print(int(n * (2 ** (n - 1))) % (1000000007))
except:
break
print(int(n * (2 ** (n - 1))) % (1000000007))
except:
break
第二题一道都没过,第三题80%。
#笔试题目##腾讯#