贪心旅行家的预算 摘要:解题思路: 这和一般的加油问题有不同,一般的加油问题是求最小加油次数,那么它每次在加油站加油都是加满只是应该在哪些个加油站加的问题,它的贪心点在于每一步只考虑当前的油量够不够行驶到下一个加油站,够…… 题解列表 2023年10月18日 0 点赞 0 评论 718 浏览 评分:9.9
先通分,后递归化简,python 摘要:n=int(input())t=[]for x in range(n): t.append(list(map(int,input().split('/'))))m=[]for x…… 题解列表 2023年10月18日 0 点赞 0 评论 533 浏览 评分:0.0
索引来解,dddd 摘要:while True: try: data = input().strip().split() if len(data) == 8: & 题解列表 2023年10月18日 0 点赞 0 评论 468 浏览 评分:9.9
找第一个只出现一次的字符 摘要:解题思路:可用列表将出现一次的字符打包注意事项:打包后,应先判断列表是否为空参考代码:a=input()ls=[]for i in a: if (a.count(i)==1): l…… 题解列表 2023年10月18日 0 点赞 0 评论 492 浏览 评分:0.0
要加EOF,这是满分 摘要:while True: try: line = input().strip() if line == 'END': 题解列表 2023年10月18日 0 点赞 0 评论 540 浏览 评分:9.9
最短的代码 摘要:while True: line = input().strip() if line == '0': break numbers = l…… 题解列表 2023年10月18日 0 点赞 0 评论 543 浏览 评分:7.3
绝对是这道题最短代码,轻松解决 摘要:import math def is_jx(n): return sum(math.factorial(int(digit)) for digit in str(n)) == n jx_…… 题解列表 2023年10月17日 0 点赞 0 评论 691 浏览 评分:9.9
我来告诉你高手怎么解题 摘要:from itertools import permutations options = [7, 6, 5, 4, 3, 2, 1] for perm in permutations(option…… 题解列表 2023年10月17日 0 点赞 0 评论 853 浏览 评分:9.9
字符串距离:一种典型动态规划 解题思路:在这个题目中,要求求两个字符串之间的最小距离,在初始化字符串的时候先分别考虑两个字符串为空的情况,当其中一个为空时,另外一个字符串对应的每一个字符的位置上都是加k(空字符与任意字符的距离),初始化完成后开始更新动规数组,其中dp[i][j]表示在A字符的前i个字符, 题解列表 2023年10月17日 0 点赞 0 评论 634 浏览 评分:9.9
温度转换Python 解题思路:注意事项:参考代码:F=float(input())c=5*(F-32)/9print("c=%.2f"%c) 题解列表 2023年10月17日 1 点赞 0 评论 1179 浏览 评分:0.0