转换成每一步代价不等的最短路问题,采用优先队列(堆)解决 摘要:解题思路:设堆顶的状态为x,y,fat,time。那么从x,y向四个方向搜索下一个点tx,ty时,有的方向会因为肥胖问题无法移动,这时我们减小身材,让他能达到tx,ty这个点(注意身材减小为1时,一定…… 题解列表 2023年05月17日 0 点赞 0 评论 288 浏览 评分:8.0
收集瓶盖赢大奖 摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){ int a,b; cin>>a>>b; …… 题解列表 2023年05月20日 0 点赞 0 评论 232 浏览 评分:8.0
禁止作弊! 摘要:解题思路:用勾股定理注意事项:禁止作弊!#include<bits\c++.h>using namespace std;int main(){ int a,b,c; cin>>a>>b>>c;…… 题解列表 2023年06月03日 0 点赞 1 评论 441 浏览 评分:8.0
题解:骑车与走路 摘要:各位好,我们学了if的结构,想要知道它的结构请看我的文章我来把关于此题if的结构写出来#include <bits/stdc++.h> //注意要改万能头 using namespac…… 题解列表 2023年06月03日 0 点赞 0 评论 326 浏览 评分:8.0
c语言代码解决问题 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int f(int x){ int f1=1,f2=2,i,f3; if (x == 1) return f1…… 题解列表 2023年06月16日 0 点赞 0 评论 605 浏览 评分:8.0
1000: [竞赛入门]简单的a+b (python代码) 摘要: while True: #while True 语句中一定要有结束该循环的break语句,否则会一直循环下去的 try: #Python 中,用try except语句块捕获…… 题解列表 2023年07月09日 3 点赞 0 评论 944 浏览 评分:8.0
简单又实用 摘要:以下的代码解析: calculateCoins函数接收一个正整数days作为参数,然后使用一个循环计算从第一天开始的给定天数内骑士获得的金币总数。我们使用三个变量:totalCoins表示总金币…… 题解列表 2023年07月10日 0 点赞 0 评论 701 浏览 评分:8.0
[编程入门]选择排序 摘要:解题思路:先定义一个数组用来存放整型数据,然后从数组第一个数开始和后面每一个数比较,找到比第一个数小的数,交换两个数的位置,接着往后比较,直到比较完,这时第一个数已经是最小的,开始从第二个数比较,重复…… 题解列表 2023年07月11日 0 点赞 0 评论 236 浏览 评分:8.0
数1的个数(C++代码) 摘要:参考代码:#include<iostream>using namespace std;int countOnes(int n) { int count = 0; for (int i = …… 题解列表 2023年07月12日 0 点赞 0 评论 315 浏览 评分:8.0
2831: 画矩形 摘要:参考代码:#include<bits/stdc++.h>using namespace std;int main(){ int a,b,d; char c; cin>>a>>b>>c…… 题解列表 2023年07月13日 0 点赞 0 评论 277 浏览 评分:8.0