
数据结构-杂题
文章平均质量分 69
Flynn_curry
这个作者很懒,什么都没留下…
展开
-
hdu1237 简单计算器
#include #include #include #include using namespace std;int main(){ int i; double a, b; char s[1005], c; while(gets(s), strcmp(s, "0") != 0) { stack原创 2015-11-23 19:13:20 · 500 阅读 · 0 评论 -
UVA - 514 Rails
#include #include using namespace std;const int MAXN = 1000 + 10;int n, target[MAXN];int main(){ while(~scanf("%d", &n) && n) { while(~scanf("%d", &target[1]原创 2015-10-29 15:44:43 · 427 阅读 · 0 评论 -
UVA - 11988 Broken Keyboard (a.k.a. Beiju Text)
#include #include const int maxn = 100000 + 5;int last, cur, next[maxn];char s[maxn];int main(){ while(scanf("%s", s+1) == 1) { int n = strlen(s+1); las原创 2015-10-30 10:21:32 · 457 阅读 · 0 评论 -
hdu1280 前m大的数(哈希打表)
http://acm.hdu.edu.cn/showproblem.php?pid=1280题意:中文题思路:3000*3000个数数量很大,所以只需对其大小哈希打表即可。水题秒之。#include #include #include #include #include using namespace std;typedef long long ll原创 2017-03-11 20:43:15 · 1031 阅读 · 1 评论 -
hdu1040 As Easy As A+B(堆排序)
http://acm.hdu.edu.cn/showproblem.php?pid=1040题意:普通的排序题,用来练习排序。思路:从小到大排,用大顶堆。堆排序,有两个函数:HeapSort():(1)、对每个有孩子的节点从大到小依次调整,从而构建成大顶堆;(2)、每次将堆顶和当前堆最后元素交换,然后对除了最后一个元素的堆调整。HeapAdjust():原创 2017-03-12 21:54:21 · 502 阅读 · 0 评论 -
hdu1106 排序(堆排序)
http://acm.hdu.edu.cn/showproblem.php?pid=1106题意:中文题。思路:很不错的水题。本来想水下堆,结果被格式卡了两次WA= =需注意结尾不是5的,中间有连续5的。中间的0不要跳过,直接乘上就好。#include #include #include #include #include using namespa原创 2017-03-13 20:39:44 · 629 阅读 · 0 评论 -
poj3617 Best Cow Line(贪心+字符串)
http://poj.org/problem?id=3617题意:给你一个字符串,通过不断地对其进行头尾比较输出较小的构建字典序最小字符串,输出。思路:很不错的水题,首先是贪心思想,就如挑战书上所说,将当前字符串与其反转的字符串比较,使末尾字符相等的字符串依然消除较小的。较大的字符串最后一个元素进队列,并将其消除,最后输出队列。输入输出还是用cin和cout,处理字符串还是c+原创 2017-03-15 16:16:27 · 522 阅读 · 0 评论 -
gplt L2-009. 抢红包(结构体排序)
https://www.patest.cn/contests/gplt/L2-009题意:中文题。。思路:比较典型的结构体排序,完全按照自己的想法1A的,可还是感觉有点不踏实,应该是还不熟练吧。#include #include #include #include #include using namespace std;typedef long l原创 2017-03-05 21:10:40 · 610 阅读 · 0 评论