题解列表

筛选

编写题解 1861: 程序员爬楼梯

解题思路:类似于斐波那契数列不过递推公式为:F(n)=F(n-1)+F(n-3)注意事项:参考代码:n=int(input())dp=[1,1,2,3]#dp[i]中i阶i中方法ifn<5:print(dp[n-1])else:whileTrue:num=dp[-1]+dp[-3]dp.append(

1068: 二级C语言-温度转换

摘要:解题思路:注意事项:参考代码:def ctof(i):    print(&#39;c=%d->f=%d&#39;%(i,32 + i* 9/5))for i in range(-100,151,5)……

编写题解 2819: 数字反转

摘要:解题思路:注意事项:参考代码:n=input()fn=str(abs(int(n)))#取整+绝对值+字符串,避免‘-’的影响r=0#反转新数for j in range(len(fn)-1,-1,-……

index查找列表下标

解题思路:注意事项:参考代码:n=int(input())a=list(map(int,input().split()))print(a.index(max(a))+1)

Python时间超限解决方法

摘要:解题思路:如果给出的n非常大,需要循环的次数非常多,导致时间超限。不妨恰定一个范围,使循环次数大大减少。注意事项:参考代码:def b(n):    s = 0    for i in range(l……

动态规划 1275: 吹哨传球

摘要:解题思路:注意事项:参考代码:a,b = map(int,input().split()) dp = [list(0 for i in range(a+1))for i in range(b+1)]……