通过列表高效解决母牛递归问题 摘要:解题思路:while True + break解决多行输入问题,列表存储解决超时问题,my_list[ ]存储每一年的母牛数注意事项: 当且仅当n>before_max(历史最大输入)时,才允许…… 题解列表 2024年02月21日 0 点赞 0 评论 323 浏览 评分:7.0
连续出现的字符 摘要:k = int(input()) s = input() for i in range(len(s) - k + 1): window = s[i:i+k] if len(…… 题解列表 2024年02月21日 1 点赞 1 评论 330 浏览 评分:9.9
最长最短单词 摘要:解题思路:注意事项:参考代码:sentence = input().split() # 分割输入的句子为单词列表longest_word = max(sentence, key=len) # 找到…… 题解列表 2024年02月21日 0 点赞 3 评论 417 浏览 评分:9.9
编写题解 1762: printf基础练习 摘要:解题思路:注意事项:这道题年代较长,如今的python3.8.6需要print('0o%o 0x%x'%(n,n))参考代码:n=123456789print('0%o 0x%…… 题解列表 2024年02月21日 0 点赞 0 评论 809 浏览 评分:9.9
数组替换:纯纯文字游戏 摘要:解题思路:切片就能写出来,问题是题目中说到“数组a中只需改变n个元素”,也就是说当m1+n1<m的时候第一个数组中剩下的元素也要加上不能去掉跟你玩文字游戏参考代码:a,b=map(int,input(…… 题解列表 2024年02月21日 0 点赞 0 评论 341 浏览 评分:9.9
用Python写真的太简单了!!! 摘要:```python list_1 = input() list_2 = [] i = 1 j = 1 if list_1[0] == '1': list_2.append('1')…… 题解列表 2024年02月20日 1 点赞 0 评论 354 浏览 评分:9.9
暴力 只过了一个 ,其他内存超限初学实在不会改 摘要:解题思路:就是直接模拟题目注意事项:只过了一个,其他内存超限 放这里也是想听大伙的意见参考代码:from itertools import permutations n = int(input())…… 题解列表 2024年02月20日 0 点赞 0 评论 368 浏览 评分:2.0
1042: [编程入门]电报加密 摘要:解题思路:注意事项:参考代码:c=str(input())for i in c: if 'a'<=i<='z' or 'A'<=i<='Z…… 题解列表 2024年02月20日 0 点赞 0 评论 314 浏览 评分:0.0
就是0,1背包问题 摘要:参考代码:# 获取输入的两个整数T和M,分别表示背包容量和物品数量T, M = map(int, input().split())# 初始化动态规划数组dp,长度为T+1,用于存储背包容量从0到T的最…… 题解列表 2024年02月20日 0 点赞 0 评论 315 浏览 评分:0.0
删除数组中的0元素 摘要:解题思路:倒着删除或者取非0元素就行,需要考虑的只有数组长度改变的问题参考代码:a=int(input())b=list(map(int,input().split()))for i in range…… 题解列表 2024年02月20日 0 点赞 0 评论 775 浏览 评分:9.9