PAT
热爱Data的直男熙哥
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
算法笔记 大整数运算 N的阶乘 大整数排序
大整数相关运算 加法 #include <stdio.h> #include <iostream> #include <string.h> using namespace std; struct bign{ int d[1005]; int len; bign(){ memset(d,0,sizeof(d)); len=0; } }; bign change(char str[]){ bign a原创 2020-10-06 15:43:57 · 480 阅读 · 1 评论 -
PAT A1033:To Fill or Not to Fill 贪心算法
思路 在输入数据后,无法保证是按照从杭州到终点的路途顺序输入的加油站,所以需要先对station进行sort。 保证起始站有station,否则无法出发,输出"The maximum travel distance = 0.00" 到达一个station时,向后遍历,有如下几种情况: 找到一个比当前station1油价便宜的station2,直接从现station1加合适量的油到station2,注意⚠️,其中可能会产生剩油情况,将会在下一个tips说明。 需加油量:station[next].Di-.原创 2020-09-11 17:14:15 · 291 阅读 · 0 评论 -
PAT A1046 Shortest Distance
Accepted: #include <stdio.h> #include <iostream> #include <vector> using namespace std; int main(){ vector<int> exits; vector<int> evsum; int n=0; int sum=0; scanf("%d",&n); for(int i=0;i<n;i++){原创 2020-09-08 08:16:29 · 151 阅读 · 0 评论
分享