上一页 1 ··· 5 6 7 8 9 10 下一页
摘要: Description George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to 阅读全文
posted @ 2018-08-16 17:11 kpole 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 数独(深搜)数据最弱版本(poj 2676) Description Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown 阅读全文
posted @ 2018-08-16 16:57 kpole 阅读(364) 评论(0) 推荐(1) 编辑
摘要: 背景 Freda和rainbow饲养了N只小猫,这天,小猫们要去爬山。经历了千辛万苦,小猫们终于爬上了山顶,但是疲倦的它们再也不想徒步走下山了(呜咕 _=ans) return; if(now==n+1) { ans = min(ans,cnt); return ; } for(int i=1;iy 阅读全文
posted @ 2018-08-15 21:56 kpole 阅读(1377) 评论(2) 推荐(1) 编辑
摘要: 描述 给定一张N个点M条边的有向无环图,分别统计从每个点出发能够到达的点的数量。N,M≤30000。 输入格式 第一行两个整数N,M,接下来M行每行两个整数x,y,表示从x到y的一条有向边。 输出格式 共N行,表示每个点能够到达的点的数量。 样例输入 样例输出 分析:拓扑排序,为了计数方便避免重复记 阅读全文
posted @ 2018-08-15 21:16 kpole 阅读(514) 评论(0) 推荐(1) 编辑
摘要: 背景 这里有n列火车将要进站再出站…… 但是,每列火车只有1节 那就是车头…… 描述 有n列火车按1到n的顺序从东方左转进站,这个车站是南北方向的,它虽然无限长,只可惜是一个死胡同,而且站台只有一条股道,火车只能倒着从西方出去,而且每列火车必须进站,先进后出。 (某生:不就是个栈吗?每次可以让右侧头 阅读全文
posted @ 2018-08-14 17:13 kpole 阅读(812) 评论(0) 推荐(0) 编辑
摘要: 描述 输入一个长度为n的整数序列,从中找出一段不超过m的连续子序列,使得整个序列的和最大。 例如 1, 3,5,1, 2,3 当m=4时,S=5+1 2+3=7 当m=2或m=3时,S=5+1=6 输入格式 第一行两个数n,m(n,msum[j2],那么j1可以直接抛弃,也就是在这个j的序列里,必须 阅读全文
posted @ 2018-08-14 17:08 kpole 阅读(679) 评论(0) 推荐(0) 编辑
摘要: Description 你在一家 IT 公司为大型写字楼或办公楼(offices)的计算机数据做备份。然而数据备份的工作是枯燥乏味 的,因此你想设计一个系统让不同的办公楼彼此之间互相备份,而你则坐在家中尽享计算机游戏的乐趣。已知办公 楼都位于同一条街上。你决定给这些办公楼配对(两个一组)。每一对办公 阅读全文
posted @ 2018-08-14 16:54 kpole 阅读(390) 评论(0) 推荐(0) 编辑
摘要: "POJ 2442" Description Given m sequences, each contains n non negative integer. Now we may select one number from each sequence to form a sequence wit 阅读全文
posted @ 2018-08-14 16:39 kpole 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 一.Hash Smowflake Snow Snowflakes( "poj3349" ) 题意:给几组数字,每组都只有6个,判断是否存在顺时针或者逆时针相同顺序遍历的两组数字。 坑:按照书上的hash方法始终TL,但是还没有研究出来这是为什么。 字符串 KMP Period( "POJ1961" 阅读全文
posted @ 2018-08-13 16:45 kpole 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 逆序对 1.利用归并排序 c++ void merge_sort(int l,int mid,int r) { int k = r l+1; int i = l,j=mid+1; for(int m=l;mr||i=1;x =lowbit(x)) { temp+=c[x]; } return tem 阅读全文
posted @ 2018-08-10 16:47 kpole 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 二分 整数集合上的二分 缩小范围时,r=mid,l=mid+1,取中间值时,mid=(l+r) 1. 缩小范围时,l=mid,r=mid 1,取中间值时,mid=(l+r+1) 1. 原因是第二种如果不使mid的值倾向于r,可能最后会使其产生死循环。 因为mid=(l+r) 2不会取到r值,mid= 阅读全文
posted @ 2018-08-09 18:03 kpole 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 快速幂 输入a,b,p; 求a的b次幂对p求余。 把b拆成二进制数,通过位运算得到最低位来巧妙降低复杂度。 成对变换 对于非负整数n 若n为偶数,则n^1等于n+1 若n为奇数,则n^1等于n 1 lowbit运算 lowbit(n)定义为非负整数n在二进制表示下“最低位的1及其后边所有的0”构成的 阅读全文
posted @ 2018-08-08 22:15 kpole 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 54701 Accepted Submission(s): 19121 Problem 阅读全文
posted @ 2018-08-04 16:49 kpole 阅读(117) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=5253 个人失误总结:sort排序范围要严格。 阅读全文
posted @ 2018-08-03 14:33 kpole 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 分析: 1.由于价格是递减的,所以可能出现si*pi>sj*pj(j>i)。所以要有一个数组来储存当前端点的最小值。 2.然后二分查找当前的si,比较q*p[i]和M[i+1].不过在这之前要确认i是小于n的。】 3.upper_bound是返回第一个大于当前值得坐标,否则返回左闭右开的右端点。而l 阅读全文
posted @ 2018-07-27 21:27 kpole 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Description My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of vari 阅读全文
posted @ 2018-07-25 22:13 kpole 阅读(251) 评论(0) 推荐(0) 编辑
摘要: Description It is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid of this boring process. 阅读全文
posted @ 2018-07-25 22:09 kpole 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Description Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,... 阅读全文
posted @ 2018-07-25 21:47 kpole 阅读(118) 评论(0) 推荐(0) 编辑
摘要: You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to so 阅读全文
posted @ 2018-07-24 22:06 kpole 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 分析: 1. 为了一致性,首先要确定外边先赋值谁。当行数为奇数二倍-1时,最外层是中心块。否则是外框字符。 2.然后遍历赋值时候。从上到下。漏斗形状赋值。同步过程中,由于图形对称,坐标反一下即可。 阅读全文
posted @ 2018-07-24 21:44 kpole 阅读(189) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 下一页