摘要: 和上个DFS的问题一样,这次用BFS的思想,BFS没有像DFS那样专门有个step累加,是靠队列思想实现,更像一群路径竞速,最快的到达后,就break输出了#include struct node{ int x; int y; int f;//父亲在队列中的编号,本题不要求输出路径... 阅读全文
posted @ 2016-07-30 09:45 Lawliet__zmz 阅读(235) 评论(0) 推荐(0)
摘要: 解救人质,给一张二维地图,有障碍的点不能移动,给定起始点和人质坐标,求到达人质路程的最短路程,DFS模型#include #include using namespace std;int n,m,p,q,Min=99999999;int a[51][51],book[51][51];void dfs... 阅读全文
posted @ 2016-07-29 20:52 Lawliet__zmz 阅读(157) 评论(0) 推荐(0)
摘要: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=8&problem=620&mosmsg=Submission+received+with+ID+1775... 阅读全文
posted @ 2016-07-29 18:45 Lawliet__zmz 阅读(156) 评论(0) 推荐(0)
摘要: //小哈面前有三个箱子,手上有1,2,3三张牌,规定能放小牌就放小牌,小哈放完最后一个箱子后,最后在箱子的牌能有几种排列?#include #include using namespace std;int a[10],book[10],n;void dfs(int step) //step表示站在第... 阅读全文
posted @ 2016-07-29 16:01 Lawliet__zmz 阅读(379) 评论(0) 推荐(0)
摘要: 一个没用到大数的进制转换的思想:http://www.cnblogs.com/phinecos/archive/2009/09/11/1564975.html二、八、十、十六进制转换(图解篇):http://www.cnblogs.com/gaizai/p/4233780.html题目连接:http... 阅读全文
posted @ 2016-07-28 17:36 Lawliet__zmz 阅读(152) 评论(0) 推荐(0)
摘要: RailsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 31441 Accepted: 12222DescriptionThere is a famous railway station in PopP... 阅读全文
posted @ 2016-07-27 16:10 Lawliet__zmz 阅读(185) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include //olower 将大写字母转换为小写字母#include using namespace std;map cnt;vector words;string biaozhun(const st... 阅读全文
posted @ 2016-07-27 09:34 Lawliet__zmz 阅读(115) 评论(0) 推荐(0)
摘要: 1、迭代器是一种对象,它能够用来遍历STL容器中的部分或全部元素,每个迭代器对象代表容器中的确定的地址。迭代器修改了常规指针的接口,所谓迭代器是一种概念上的抽象:那些行为上象迭代器的东西都可以叫做迭代器。然而迭代器有很多不同的能力,它可以把抽象容器和通用算法有机的统一起来。2、迭代器提供一些基本操作... 阅读全文
posted @ 2016-07-26 21:49 Lawliet__zmz 阅读(138) 评论(0) 推荐(0)
摘要: The Blocks ProblemTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5404 Accepted: 2314DescriptionMany areas of Computer Science use simple, a... 阅读全文
posted @ 2016-07-26 21:09 Lawliet__zmz 阅读(215) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std;int sum[1002];char str[1000];int main(){ while(scanf("%s",str)&&strcmp(str,"0")) { int len... 阅读全文
posted @ 2016-07-26 10:55 Lawliet__zmz 阅读(160) 评论(0) 推荐(0)
摘要: 必须去掉前导0和后导0,一个特殊数据是对000.00这样的输出0#include#includeusing namespace std;int main(){ string r; int n,dianwei; const int R_LEN=150;//存下的极限数位大小 s... 阅读全文
posted @ 2016-07-26 09:16 Lawliet__zmz 阅读(171) 评论(0) 推荐(0)
摘要: Modular multiplication of polynomialsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4516 Accepted: 2033DescriptionConsider po... 阅读全文
posted @ 2016-07-26 00:13 Lawliet__zmz 阅读(280) 评论(0) 推荐(0)
摘要: Word AmalgamationTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9164 Accepted: 4375DescriptionIn millions of newspapers acros... 阅读全文
posted @ 2016-07-24 17:25 Lawliet__zmz 阅读(179) 评论(0) 推荐(0)
摘要: 对多个字符串排序,比较函数用strcmp写,如string数组存储的多个字符串#include #include #include #include #include using namespace std;string s[110];bool cmp (string a, string b) { ... 阅读全文
posted @ 2016-07-24 16:16 Lawliet__zmz 阅读(202) 评论(0) 推荐(0)
摘要: Hay PointsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6269 Accepted: 4006DescriptionEach employee of a bureaucracy has a j... 阅读全文
posted @ 2016-07-24 15:25 Lawliet__zmz 阅读(151) 评论(0) 推荐(0)
摘要: 栈的存储结构分为顺序存储结构(用数组实现)和链表存储结构(用链表实现)相同点:从"数据结构"的角度看,它们都是线性结构,即数据元素之间的关系相同。不同点:栈(Stack)是限定只能在表的一端进行插入和删除操作的线性表。 队列(Queue)是限定只能在表的一端进行插入和在另一端进行删除操作的线性表。它... 阅读全文
posted @ 2016-07-24 10:14 Lawliet__zmz 阅读(178) 评论(0) 推荐(0)
摘要: TEX QuotesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10056 Accepted: 5250DescriptionTEX is a typesetting language develop... 阅读全文
posted @ 2016-07-23 19:45 Lawliet__zmz 阅读(83) 评论(0) 推荐(0)
摘要: Inglish-Number TranslatorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5162 Accepted: 2027DescriptionIn this problem, you will be given on... 阅读全文
posted @ 2016-07-23 17:02 Lawliet__zmz 阅读(219) 评论(0) 推荐(0)
摘要: Numbers That CountTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 20129 Accepted: 6735Description"Kronecker's Knumbers" is a l... 阅读全文
posted @ 2016-07-23 16:24 Lawliet__zmz 阅读(177) 评论(0) 推荐(0)
摘要: C语言递归算法是怎么执行的#include void net(int);int main(){ net(1); return 0;}void net(int n){ printf("数字%d:n的地址是:%p\n", n, &n); if(n递归就是自己调用自己,例如... 阅读全文
posted @ 2016-07-22 22:42 Lawliet__zmz 阅读(247) 评论(0) 推荐(0)
摘要: 有一串已经从小到大排好序的数 2 3 5 8 9 10 18 26 32。现需要往这串数中插入 6 使其得到的新序列仍符合从小到大排列。链表中的每一个结点只有两个部分。我们可以用一个数组 data 来存储每序列中的每一个数。那每一个数右边的数是谁,这一点该怎么解决呢?上一节中是使用指针来解决的,这里... 阅读全文
posted @ 2016-07-19 02:35 Lawliet__zmz 阅读(142) 评论(0) 推荐(0)
摘要: #include #include#includeusing namespace std;char *catstr(char *a,char *b){char *p=a,*q=b;while(*p) p++;while(*q)*p++=*q++;*p='\0';return a;}int main(... 阅读全文
posted @ 2016-07-03 16:22 Lawliet__zmz 阅读(892) 评论(0) 推荐(0)
摘要: #include #include using namespace std;int a[101],n;void quicksort(int left,int right){ int i,j,t,tmp; if(left>right) return ; //当i变为left值... 阅读全文
posted @ 2016-06-19 23:21 Lawliet__zmz 阅读(395) 评论(0) 推荐(0)
摘要: 1.#define INF (1ll<<60)-1 表示义INF的值为2^60-1 阅读全文
posted @ 2016-06-18 17:16 Lawliet__zmz 阅读(127) 评论(0) 推荐(0)
摘要: 进制转换Problem Description输入一个十进制数N,将它转换成R进制数输出。 Input输入数据包含多个测试实例,每个测试实例包含两个整数N(32位整数)和R(210)。 Output为每个测试实例输出转换后的数,每个输出占一行。如果R大于10,则对应的数字规则参考16进制(比如,10... 阅读全文
posted @ 2016-06-18 17:09 Lawliet__zmz 阅读(144) 评论(0) 推荐(0)