![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 53
望君持之以恒
这个作者很懒,什么都没留下…
展开
-
C++分析产品功能数据生成markdown表格代码
代码功能描述:将各自产品支持的各自功能或特性汇总成一张2维大表.参考下面的输入输出样例.源代码#include <iostream>#include <string>#include <vector>#include <map>#include <algorithm>using namespace std;typedef string TYPE;typedef string ITEM;int main(){ .原创 2021-09-18 14:33:09 · 329 阅读 · 0 评论 -
[PAT] 2020年春季赛题目 完整题目 + 完整答案 + 个人总结
[PAT] 2020年春季赛题目 完整题目这次比赛在2020/07/25日举行, 距离比赛截止前5分钟.100分的人数有: 86人90分到99分的有: 142人7-1 Prime Day (20分)The above picture is from Sina Weibo, showing May 23rd, 2019 as a very cool "Prime Day". That is, not only that the corresponding number of the d.原创 2020-07-25 22:49:06 · 1933 阅读 · 2 评论 -
算法笔记 栈 中缀转后缀表达式 codeup 1918 简单计算器
#include <iostream>#include <string>#include <stack>#include <queue>#include <map>using namespace std;struct node{ double num; //操作数 char op; //操作符 bool flag; //true表示操作数, false表示操作符};string str;st.原创 2020-07-11 17:02:51 · 191 阅读 · 0 评论 -
1039 Course List for Student 使用map超时, unordered_map能过
1039 Course List for Student使用map超时, unordered_map是能够通过的.在unordered_map下使用str.resize(4); scanf("%s", &str[0]);在unordered_map下使用cin>>str的时间:正确代码:#include <iostream>#include <unordered_map>#include <vector>#inc..原创 2020-07-10 21:11:04 · 349 阅读 · 0 评论 -
1096 Consecutive Factors 样例三 测试点三 无法通过
1096Consecutive Factors(20分)Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, and 7 are the three consecutive numbers. Now given any positive N, you are ..原创 2020-07-10 15:32:58 · 403 阅读 · 0 评论 -
PAT乙级 1049 数列的片段和 (20分) PAT甲级 1104 Sum of Number Segments (20分)
我过不了啊....还是萌新的我怎么也想不到还会有精度问题....————————————————版权声明:本文为CSDN博主「冰释的温存」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。原文链接:https://blog.csdn.net/qq_21394327/article/details/1069750161049 数列的片段和 (20分)给定一个正数数列,我们可以从中截取任意的连续的几个数,称为片段。例如,给定数列 { 0.1, 0.2, 0.转载 2020-07-08 17:34:45 · 176 阅读 · 0 评论 -
B1019/A1069 数字黑洞 借用string, algorithm快速完成
通过大量库函数快速完成此题.比如 sort对字符串排序string.length()来对不足4位的数字补0to_string()将string快速转为int(还有个astox函数可以实现string.c_str()快速转数字)掌握一些库函数有利于快速做题#include <iostream>#include <algorithm>#include <string>using namespace std;int str2num(stri原创 2020-07-08 16:47:28 · 967 阅读 · 0 评论 -
1067 Sort with Swap(0, i) 使用Map 36行 短代码
和PAT书上的思路不一样。我使用了map,费内存是真的。但是换来了运行时间。使用map的思路是这样的。原来用数组,下标里面存值。用map则是key是值,value是原来数组的下标,即map<值,下标>这样就O(1)访问了。#include<map>#include<iostream>#include<algorithm>using namespace std;int main(){ int n; scanf("原创 2020-06-30 21:17:33 · 122 阅读 · 0 评论 -
简单易懂 PAT 1033 To Fill or Not to Fill 贪心算法
取消注释, 看跑路过程!贪心思路:1. 优先前往油价比当前油价更低的油站,为了前往这个油站,油箱里的油要加最少(即跑到下一站油量恰好为0),为了能去那里加更便宜的油2. 没有比当前油价低的油站时,则在能跑到的油站里寻找价格最低的油站,但是这个最低的油站也比当前油站的价格高,所以要在当前油站把油加满。3. 如果满油都到不了任意一个油站,那就说明到不了目的地,最远到达当前油站坐标+满油箱能跑的距离#include <iostream>#include <al..原创 2020-06-29 09:48:25 · 179 阅读 · 0 评论 -
C++ 学习笔记
c++入门学习笔记1. 空指针 与 野指针空指针最简单的方法是定义为nullint *p = NULL;或者 int *p= nullptr;也有把指针定义为0的, 具体参阅:http://www.cnblogs.com/porter/p/3611718.htmlhttps://www.cnblogs.com/Yan47/p/5968676.html结论: 如果使用...转载 2019-01-29 13:15:26 · 138 阅读 · 0 评论