贪心算法解决金银岛 摘要:解题思路:注意事项:参考代码:def bravery(data,w): data.sort(key=lambda x:x[2],reverse=True) &n…… 题解列表 2025年02月26日 0 点赞 0 评论 574 浏览 评分:0.0
利用循环得到n次的数字,然后求和 摘要:解题思路:每次循环把上一个值乘10再加上结尾的2注意事项:跳出循环后还需要再算一次和参考代码:int main(){ int a=2,n;&…… 题解列表 2025年02月25日 2 点赞 0 评论 1291 浏览 评分:0.0
C语言简单解法 摘要:解题思路:使用fgets来读取字符串,用fgets+strcspn()处理换行 符代替gets()可以避免gets()带来的安全风险。注意事项:注意,fgets()读取后会…… 题解列表 2025年02月25日 2 点赞 0 评论 1838 浏览 评分:10.0
土办法。感觉这题目没说仔细 解题思路:题目并没有说明m,n的奇偶性,但根据大家发的题解,好像有默认。。我发一个没默认的土办法。:)注意事项:要想清楚在range里的参数范围到底要不要+1参考代码:m,n=map(int,input().split())sum=0ifm%2==0:ifn%2==0:foriinrange(m+1, 题解列表 2025年02月25日 0 点赞 0 评论 787 浏览 评分:0.0
用筛法求之N内的素数 解题思路:注意事项:参考代码:#includeintprime(inta[],inti,intj);#definemax1000intmain(){intn,i=2,j;scanf("%d",&n);inta[max];for(i;i 题解列表 2025年02月25日 0 点赞 0 评论 602 浏览 评分:0.0 栈实现字符串匹配问题 摘要:```cpp#include #include #include using namespace std;bool check_rate(char x,char y){ …… 题解列表 2025年02月25日 0 点赞 0 评论 622 浏览 评分:0.0 编写题解 1242: 矩阵转置 摘要:#include<stdio.h>#include<math.h>#include<string.h>int&n…… 题解列表 2025年02月25日 0 点赞 0 评论 362 浏览 评分:0.0 运用广度优先搜素 解题思路:通过队列,运用广度优先搜索注意事项:在pycharm上这个代码会报错,但是提交以后是正确的参考代码:fromcollectionsimportdequedefdfs(gra):x1,y1=index(gra,"@")x2,y2=index(gra, 题解列表 2025年02月25日 0 点赞 0 评论 418 浏览 评分:0.0 使用STL中的map与priority_queue 解题思路:同时使用STL中的map与priority_queue;map具有映射功能,能够很好地统计出现次数,很好地节约空间;priority_queue用小根堆的特性可以直接将输入的数进行排序,同时效率也高;使用priority_queue记录出现的数, 题解列表 2025年02月24日 0 点赞 0 评论 593 浏览 评分:10.0 « 12...198199200201202203204...59115912 »
栈实现字符串匹配问题 摘要:```cpp#include #include #include using namespace std;bool check_rate(char x,char y){ …… 题解列表 2025年02月25日 0 点赞 0 评论 622 浏览 评分:0.0
编写题解 1242: 矩阵转置 摘要:#include<stdio.h>#include<math.h>#include<string.h>int&n…… 题解列表 2025年02月25日 0 点赞 0 评论 362 浏览 评分:0.0
运用广度优先搜素 解题思路:通过队列,运用广度优先搜索注意事项:在pycharm上这个代码会报错,但是提交以后是正确的参考代码:fromcollectionsimportdequedefdfs(gra):x1,y1=index(gra,"@")x2,y2=index(gra, 题解列表 2025年02月25日 0 点赞 0 评论 418 浏览 评分:0.0
使用STL中的map与priority_queue 解题思路:同时使用STL中的map与priority_queue;map具有映射功能,能够很好地统计出现次数,很好地节约空间;priority_queue用小根堆的特性可以直接将输入的数进行排序,同时效率也高;使用priority_queue记录出现的数, 题解列表 2025年02月24日 0 点赞 0 评论 593 浏览 评分:10.0