上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要: 1.getline输入数据2.最好使用manacher方法3.暴力方法解决不会超时暴力AC代码://#include//#include #include#include //#include#include#include#include//#include#include//#include /... 阅读全文
posted @ 2015-11-16 13:43 siukwan 阅读(137) 评论(0) 推荐(0)
摘要: 1.存在超时的危险2.根据题意,名字由3个字母和1个数字组成,所以共26*26*26*10=175760种可能,直接开辟内存AC截图://#include//#include #include#include //#include#include#include#include//#include#... 阅读全文
posted @ 2015-11-16 13:38 siukwan 阅读(152) 评论(0) 推荐(0)
摘要: 1.题目是把一些数,通过组合,变成一个最小的数(在这些数的所有组合中最小)2.使用贪心算法,贪心标准为:1)如果两个数中,数a是数b的前缀,或者数b是数a的前缀,那么判断字符串相加后a+b与b+a的大小,进行确定前后顺序2)如果不是上面1)中的两种情况,直接按照string进行大小比较3.该题目可以... 阅读全文
posted @ 2015-11-16 12:53 siukwan 阅读(132) 评论(0) 推荐(0)
摘要: 1.比较简单2.最大的正数coupon与最大的正数product相乘3.最小的负数coupon与最小的负数product相乘(最小的负数即绝对值最大)4.其他没有匹配的就不购买了。//#include//#include #include#include //#include#include#inc... 阅读全文
posted @ 2015-11-15 23:22 siukwan 阅读(140) 评论(0) 推荐(0)
摘要: 1.简单的重写比较函数//#include//#include #include#include //#include#include#include#include//#include#include//#include //#include "func.h"//#include #include... 阅读全文
posted @ 2015-11-15 23:02 siukwan 阅读(161) 评论(0) 推荐(0)
摘要: 1.简单的字符串处理2.注意0,1个没有修改是,是is,大于1个是,是are//#include//#include #include#include //#include#include#include#include//#include#include//#include //#include ... 阅读全文
posted @ 2015-11-15 22:37 siukwan 阅读(126) 评论(0) 推荐(0)
摘要: 1.该题目涉及到了并查集和一些统计2.过程1)收集根据记录,存储每个人的总通话时间和他的联系人,同时进行并查集的合并。2)根据并查集中分好的集合,进行集合的分类,并且分别统计各集合的名单和总通话时间3)遍历上面的集合,找出符合条件的gang和gang的头目注:A "Gang" is a cluste... 阅读全文
posted @ 2015-11-15 22:16 siukwan 阅读(127) 评论(0) 推荐(0)
摘要: 1.在做pat的to fill or not to fill的时候想起同样是加油站的题目,于是翻出来复习一下2.关键在于理解潜在的条件。假设油量为tank,如果到了当前站i,tank0的油量,去掉一个站,那么tank必然比现在的油量还要小,所以更加不可能达到i+1.证明:设tank[a,b]是指以a... 阅读全文
posted @ 2015-11-15 17:43 siukwan 阅读(156) 评论(0) 推荐(0)
摘要: 1.这道题目比较有趣,给出了加油站的位置和每个站的油价,求最小耗费,如果不能到达终点,则求能走的最远距离2.思路:1)采用一个油箱数组的概念,实则是一个vector,当成队列使用,这个vector记录了加了的油的价格,油的容量,通过这些油走过的长度和耗费;2)每到一个站,计算从上一站达到这个站所需要... 阅读全文
posted @ 2015-11-15 16:50 siukwan 阅读(170) 评论(0) 推荐(0)
摘要: 1.直接建立两个100001长度的数组,一个用来当作链表使用,一个用来当作后面的哈希查询使用2.遍历第一个链表,把第一个链表中存在的节点记录在哈希表中3.遍历第二个链表,如果哈希中存在某个节点的值,就break,最终输出该节点值4.把地址改为int存储,最后输出注意-1和其他的补0的情况下面为AC代... 阅读全文
posted @ 2015-11-14 22:07 siukwan 阅读(145) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页