随笔分类 - UVA
摘要:链接:https://cn.vjudge.net/problem/UVA-136 优先队列是一种抽象数据结构(Abstract Data Type, ADT),行为有些想队列,但先出队列的元素不是先进队列的元素,而是队列中优先级最高的元素,这样就可以允许类似于”急病病人插队“这样的事情发生。 STL
阅读全文
摘要:链接:https://vjudge.net/problem/UVA-540 队列是符合“先进先出”(First In First Out, FIFO)原则的“公平队列“。STL队列定义在头文件<queue>中,可以用”queue<int> s“方式声明一个队列,用push()和pop()进行元素的入
阅读全文
摘要:链接:https://vjudge.net/problem/UVA-12096 STL提供3种特殊的数据结构:栈、队列与优先队列。所谓栈,就是符合“后进先出”(Last In First Out, LIFO)规则的数据结构,有PUSH和POP两种操作,其中PUSH把元素压入“栈顶”,而POP从栈顶把
阅读全文
摘要:链接:https://vjudge.net/problem/UVA-156 map就是从key到value的映射。因为重载了[]运算符,map像是数组的“高级版”。例如可以用一个map<string,int> month_name来表示“月份名字到月份编号”的映射,然后用month_name["Ju
阅读全文
摘要:链接:https://vjudge.net/problem/UVA-10815 集合和元素也是两个常用的容器,set就是数学上的集合——每个元素最多只出现一次。单词不区分大小写。set的特性是所有元素的值会自动排序,且不允许有两个相同的元素。 set集合容器:实现了红黑树的平衡二叉树的数据结构,插入
阅读全文
摘要:链接:https://vjudge.net/problem/UVA-101 模拟四种操作,对这四种操作分析总结,找出差异,需要执行三种操作:找关键木块、把关键木块上的木块移回原位、把另一个关键木块或者包括它上面的木块移回原位。 数据结构的核心是vector<int>pile[maxn],所有操作都是
阅读全文
摘要:链接:https://vjudge.net/problem/UVA-10474 STL是之C++的标准模板库(Standard Template Library)。 题意:先排序,后查找。用vector存储排序对象,sort和lower_bound完成排序和查找。 注:vector数组要用迭代器访问
阅读全文
摘要:题目地址:https://vjudge.net/problem/UVA-400 大致题意:输入n个文件名,排序后左对齐输出,一行最多输出60字符,并且每列最右一列M字符,其他列为M+2字符 我碰到的几个坑:1求出最长的字符,每次求字符长度时用length()记得int强制类型转换 2求列数可以先减去
阅读全文
摘要:传送门:https://cn.vjudge.net/problem/UVA-1588 #include <iostream> #include <string.h> using namespace std; int kick(char *s1,char *s2, int n, int m) { in
阅读全文
摘要:传送门:https://cn.vjudge.net/problem/UVA-1587 #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; pair<i
阅读全文
摘要:题目:https://cn.vjudge.net/problem/UVA-10340 #include <iostream> #include <stdio.h> #include <string.h> using namespace std; char s[1000005],t[1000005];
阅读全文
摘要:题目:https://vjudge.net/problem/UVA-202 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=138 #include <io
阅读全文
摘要:题目链接:https://vjudge.net/problem/UVA-1368 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4114 #include
阅读全文
摘要:题目链接:https://vjudge.net/problem/UVA-232(VJ) https://vjudge.net/problem/32396/origin(UVaOJ) AC代码: #include<stdio.h> #include<iostream> #include<string>
阅读全文
摘要:贴两个题目链接,我就不粘题目了,自己去看吧。 https://vjudge.net/problem/UVA-227 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&prob
阅读全文
摘要:It is easy to see that for every fraction in the form 1 k (k > 0), we can always find two positive integers x and y, x ≥ y, such that: 1/ k = 1 /x + 1
阅读全文
摘要:Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive te
阅读全文
摘要:Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0 through 9 once each, such that the first numbe
阅读全文

浙公网安备 33010602011771号