ikun 的 python 题解
2024-10-20 21:11:25
发布于:河北
11阅读
0回复
0点赞
应该是全ACdog唯一一份吧(bushi)
def count_sequences(n):
# 初始化 dp 数组
dp = [0] * (n + 1)
dp[1] = 1 # 体重为1的鸡只有一个序列
# 计算 dp[i] 对于每个 i 从 2 到 n
for i in range(2, n + 1):
for j in range(1, i // 2 + 1):
dp[i] += dp[j]
return dp[n]
# 读取输入
n = int(input())
# 计算并输出结果
print(count_sequences(n)*2)
ikun版(0.25个(带翻译))
def ikun(n):
jntm = [0] * (n + 1)#jntm=鸡你太美
jntm[1] = 1
for jianshenshichangliangnianbandegerenlianxisheng in range(2, n + 1):#for:来自 来自健身时长两年半的个人练习生
for kun in range(1,jianshenshichangliangnianbandegerenlianxisheng // 2 + 1):#来自kun
jntm[jianshenshichangliangnianbandegerenlianxisheng] += jntm[kun]
return jntm[n]
gerenlianxisheng = int(input())#个人练习生
print(ikun(gerenlianxisheng)*2)
全部评论 1
jinitaimei=ikun(jianshenshichangliangniandegerenlianxisheng)*2.5
2024-10-20 来自 河北
0kun
2024-10-20 来自 河北
0
有帮助,赞一个