上一页 1 ··· 6 7 8 9 10 11 12 下一页
摘要: 1.使用string存储数字2.用朴素的方法检测回文3.需要考虑进位,和首位为0的情况(字符串翻转相加,为了避免长度不等,不需要去掉前面的‘0’)//#include//#include #include#include //#include#include#include#include//#in... 阅读全文
posted @ 2015-11-07 11:18 siukwan 阅读(122) 评论(0) 推荐(0)
摘要: 1.20位的数字,超过了unsigned long long的取值2.采用string进行存储和检测3.用哈希进行相同位检测//#include//#include #include#include //#include#include#include#include//#include//#inc... 阅读全文
posted @ 2015-11-07 10:53 siukwan 阅读(149) 评论(0) 推荐(0)
摘要: 1.采用map> 的结构进行存储,可利用string自身带有的排序进行排序2.如果采用map> ,输出的时候则需要考虑ID为0001111的,前面带有0的情况(主要卡在这里)//#include//#include #include#include //#include#include#includ... 阅读全文
posted @ 2015-11-06 15:06 siukwan 阅读(134) 评论(0) 推荐(0)
摘要: 1.主要是根据后序和中序还原二叉树还原函数为:class TreeNode{public: int val; TreeNode* l, *r; TreeNode(int x) :val(x), l(NULL), r(NULL){}; TreeNode() :val(0), l(NULL), r(NU... 阅读全文
posted @ 2015-11-05 22:57 siukwan 阅读(126) 评论(0) 推荐(0)
摘要: 1.采用求余的方式转换成以radix为基数的数2.使用vector来存储底数,因为后面需要以底数的形式显示,而不是以位的形式显示print N as the number in base b in the form "akak-1... a0".3.注意输入为0的情况//#include//#inc... 阅读全文
posted @ 2015-11-05 22:11 siukwan 阅读(128) 评论(0) 推荐(0)
摘要: 1.采用dijkstra计算出最小耗费cost,再用最小耗费cost作为约束条件,进行遍历2.关键在于后面如何选择最优的路径,选择需要发送最小数量的路径,如果两者发送的数量相同,则选择take数量最小的路径3.如0->2->3->4->5, 节点2缺单车,需要send,节点3单车多出来,只能够补充4... 阅读全文
posted @ 2015-11-05 00:51 siukwan 阅读(134) 评论(0) 推荐(0)
摘要: 1.在17:00:00前(包括17整)来的客户,都要确保一直执行完,即使超过了17点。譬如一个在8点来的客户,处理时间需要20小时,也需要同样服务完,然后处理队列中的客户。2.只是对17:00:00后来的客户拒绝服务。3.逻辑顺序有问题,需要先插入,然后再减时间。4.首次插入,需要判断时间是否合适。... 阅读全文
posted @ 2015-11-04 22:04 siukwan 阅读(143) 评论(0) 推荐(0)
摘要: 1.需要熟悉进制转换的方法2.进制转换的第一步,通过求余求出string,此时的string恰好是倒序的正确的进制转换:while (num != 0) {//求余,把它转化为d进制格式的数,但求出来的string刚好是反的 char c = num%d + '0'; s += c; ... 阅读全文
posted @ 2015-11-04 12:59 siukwan 阅读(111) 评论(0) 推荐(0)
摘要: 1.判断记录好坏,把所有记录以string存起来,按照字典序排序,相邻的两条记录满足要求:第一条为on-line且第二条为off-line,才是成功匹配;2.采用计算00:00:00到现在的耗费和分钟数,这个方法比较简单3.最重要的:题目中只强调至少有一条匹配成功的记录,不是说每个人都至少有一条匹配... 阅读全文
posted @ 2015-11-04 12:47 siukwan 阅读(132) 评论(0) 推荐(0)
摘要: 1.银行排队时间模拟,采用合适的结构进行编程2.超过17:00(包括17:00)不再接受新用户,已经在处理的用户可以一直处理到17:59//#include//#include #include#include //#include#include#include#include//#include... 阅读全文
posted @ 2015-11-04 12:44 siukwan 阅读(128) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 下一页