ZOJ 1109 Language of FatMouse】的更多相关文章

题目连接: acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1109 题目描述: We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him. Input Specifica…
Language of FatMouse Time Limit: 10 Seconds      Memory Limit: 32768 KB We all know that FatMouse doesn't speak English. But now he has to beprepared since our nation will join WTO soon. Thanks to Turing we havecomputers to help him. Input Specificat…
Language of FatMouse Time Limit: 10 Seconds      Memory Limit: 32768 KB We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him. Input Specific…
较简单字典树,每输入一对字符串,前一个放在字典(数组)中,后一个插入字典树中,并将其最终的flag赋为前一个在数组中的下标,再就好找了.输入的处理方法要注意一下. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <string> #include <cstdlib…
好开心,手动自己按照字典树的思想用c写了一个优化后的trie字典树,就是用链表来代替26个大小的字符数组.完全按照自己按照自己的想法打的,没有参考如何被人的代码.调试了一天,居然最后错在一个小问题上,郁闷啊!!!最后终于调试出来了!!一次提交就ac了!!开心溢于言表啊!!!!!! /* trie树: 插入: 插入一段字符串: 每个字符作为树的一层(同一层的节点通过兄弟节点项连),每个节点如果有后继节点的话,就把最大的后继放到其后面. 如果字符串结束,就在该节点处,connt++;然后用一个字符串…
<题目链接> 题目大意: 刚开始每行输入两个单词,第二个单词存入单词库,并且每行第二个单词映射着对应的第一个单词.然后每行输入一个单词,如果单词库中有相同的单词,则输出它对应的那个单词,否则输出“eh”. 解体分析: 本题是trie树的模板题,在建树的时候,在每个单词的结尾节点储存对应单词的序号即可.当然,本题用map也可做,但是效率不够高. #include<cstdio> #include<cstring> #include<iostream> #inc…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=109 题目意思:给出一个mouse-english词典,问对于输入的mouse单词,能否在这个词典里找出对应的english,不能输出“eh” 这里用到map来做,value 保存 english,key保存mouse. #include <iostream> #include <cstdio> #include <cstdlib> #inc…
这道题目最让人头疼的就是该题的input怎么结束,因为它要求输入一个空行的时候则一串字符串输入结束,这就不得不让人绕个弯来解决这个问题. (注:本人习惯于使用C中的字符串操作,但是用到map要求使用string所以小绕弯) #include <map> #include <iostream> #include <string> #include <stdio.h> #include <string.h> #include <stdlib.h…
Language of FatMouse Time Limit: 10 Seconds      Memory Limit:32768 KB We all know that FatMouse doesn't speak English. But now he has to be prepared since our nation will join WTO soon. Thanks to Turing we have computers to help him. Input Specifica…
题目大意:给你n只老鼠的体重w和速度s,让你找出最长的子序列使得w[i] < w[j] 且 s[i] > s[j] (i < j).求最长序列的长度并输出该序列. LIS(Longest Increasing Subsequence)问题,先对老鼠进行排序,以w为第一关键字从小到大排序,再以s为第二关键字从大到小排序,然后就是LIS问题的处理了.LIS(i)表示以a[i]结尾的最长增长序列的长度. #include <cstdio> #include <algorith…