
Hashing / Sets
MissAnnLucky
Cease to struggle cease to live.
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
UVA 10591 - Happy Number
#include #include using namespace std; setvis; int main() { //freopen("in.txt","r",stdin); int cas,num,sum,flag,nn; scanf("%d",&cas); for(int i=1; i<=cas; i++) { scanf("%d"原创 2013-05-25 20:50:19 · 519 阅读 · 0 评论 -
UVA 10282 - Babelfish
#include #include #include #include #include using namespace std; mapvis; int main() { //freopen("in.txt","r",stdin); char str[100]; // string ss; int i,flag=0; vis.clear(); wh原创 2013-05-25 21:28:16 · 550 阅读 · 0 评论 -
UVA 10125 - Sumsets
这个题有两种方法,一种是直接暴力搜索,但是也是有技巧的,先给数组排序,然后从最大的数开始搜索,如果能找到3个数和是这个数,直接结束循环,输出这个数。代码如下:(时间是1.618) #include #include using namespace std; int main() { //freopen("in.txt","r",stdin); int n,num[1010],fl原创 2013-05-27 18:46:51 · 508 阅读 · 0 评论 -
UVA 141 - The Spot Game
哈哈,非常独立的完成了这个题目,虽然WA了好几次,但是独立嘛,好的开始,要坚持! 这个题主要是状态的保存,因为要判断之前是否出现过,所以把每次移动后的状态用map保存的,(某一点有棋子用‘2’表示,没有用‘1’表示,然后转化成字符串,string类),比较奇怪的是,两种保存状态都AC了: 1:只保存每次移动后的状态 2:保存每次移动后的状态,以及顺时针旋转90度,逆原创 2013-05-29 20:04:57 · 498 阅读 · 0 评论 -
uva 10887 - Concatenation of Languages
这个题,,,无语了,各种错误十几遍。 1.不能用scanf读单词,因为可能会有空串(虽然题目中没有说) 2.惯用的一种方式,scanf("%d%d\n",&m,&n);gets(str);本以为这样会避免了gets读取空格,但是提交后会WA,!!!教训 3.读取完第一种单词后,在读取第二种单词时,每读一个就和第一种单词组合(按题目要求,第一种单词在前,第二种在后原创 2013-05-30 15:27:15 · 499 阅读 · 0 评论 -
SPOJ 1108. Card Trick 模拟题
题目描述: SPOJ Problem Set (classical) 1108. Card Trick Problem code: CTRICK The magician shuffles a small pack of cards, holds it face down and performs the following proced原创 2013-08-01 19:29:14 · 765 阅读 · 0 评论 -
vector简单用法
c.front() 返回第一个元素 c.back() 返回最后一个元素 c.push_back(e) 在尾部插入元素e c.pop_back() 删除最后一个元素 c.clear() c.erase(pos) 删除pos位置的元素 c.erase(b原创 2013-07-24 15:13:09 · 470 阅读 · 0 评论