本文为SIT2025新生赛Python版本题解,仅供参考,如有疑问可群里艾特"木子木" 本文标题均可点击链接跳转题目
A 欢迎来到SIT算法竞赛社#
_ = input()
print(sum(list(map(int, input().split()))))
B 寻找平衡日#
n = int(input())
nums = list(map(int, input().split()))
total = sum(nums)
prefix = [sum(nums[:i]) for i in range(len(nums) + 1)]
for i in range(1, n + 1):
left_sum = prefix[i - 1]
right_sum = total - prefix[i]
if left_sum == right_sum:
print(i)
exit(0)
print(-1)
C 编程友谊赛#
from collections import defaultdict
from math import comb
count = defaultdict(int)
for _ in range(int(input())):
s = input().strip()
freq = ''.join(sorted(f"{c}:{s.count(c)}" for c in set(s)))
count[freq] += 1
print(sum(comb(v, 2) for v in count.values()))
D 队伍分配问题#
n = int(input())
nums = list(map(int, input().split()))
print("true" if len(set(nums)) == n else "false")
E 能做到吗#
x, y, n, t, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dp = [0] * (y + 1)
for i in range(n):
for j in range(y, a[i] - 1, -1):
dp[j] = max(dp[j], dp[j - a[i]] + b[i])
if x + dp[y] // t >= k:
print("YES")
else:
print("NO")
F 社长选举#
暴力解法(TLE)
n = int(input())
nums = list(map(int, input().split()))
max_cnt, best_k = -1, 0
for k in range(n):
count = 0
for i in range(n):
if nums[i] <= (i + k) % n:
count += 1
if count > max_cnt:
max_cnt, best_k = count ,k
print(best_k)
J 你的故事你来写#
print("你的故事你来写")
