随笔分类 -  OJ_HDU

摘要:#include #include "string" #include "cstdio" #include "cstring" using namespace std; #define N 10010 #define INF 0x3f3f3f3f #define MOD 7 /**输入一个十进制数N,将它转换成R进制数输出。 定义一个数组s[16]={'0','1','2','3','... 阅读全文
posted @ 2017-11-04 17:09 kimsimple 阅读(712) 评论(0) 推荐(0)
摘要:Description 由于长期缺乏运动,小黑发现自己的身材臃肿了许多,于是他想健身,更准确地说是减肥。 小黑买来一块圆形的毯子,把它们分成三等分,分别标上A,B,C,称之为“跳舞毯”,他的运动方式是每次都从A开始跳,每次都可以任意跳到其他块,但最后必须跳回A,且不能原地跳.为达到减肥效果,小黑每天 阅读全文
posted @ 2017-10-03 17:13 kimsimple 阅读(304) 评论(0) 推荐(0)
摘要:经典约瑟夫环 变形:k是变化的 阅读全文
posted @ 2017-09-02 23:44 kimsimple 阅读(251) 评论(0) 推荐(0)
摘要:Josephus again Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 652 Accepted Submission(s): 181 Pr 阅读全文
posted @ 2017-09-02 23:38 kimsimple 阅读(225) 评论(0) 推荐(0)
摘要:Recursive sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1525 Accepted Submission(s): 7 阅读全文
posted @ 2017-08-21 00:10 kimsimple 阅读(153) 评论(0) 推荐(0)
摘要:Sample Input 3 1 3 5 2 1 3 5 1 3 5 99 69 3 1 3 5 2 1 3 5 1 3 5 99 69 Sample Output Case #1: No Case #2: Yes Case #3: Yes Hint 对于第一组测试数据:111 mod 5 = 1, 阅读全文
posted @ 2017-08-04 23:02 kimsimple 阅读(168) 评论(0) 推荐(0)
摘要:给一个数n,让你求一个大于等于n的最小的满足题意中2^a*3^b*5^c*7^d的数字。 思路: 阅读全文
posted @ 2017-06-30 21:20 kimsimple 阅读(250) 评论(0) 推荐(0)
摘要:Cure Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 293 Accepted Submission(s): 96 Problem Descr 阅读全文
posted @ 2017-06-29 22:58 kimsimple 阅读(156) 评论(0) 推荐(0)
摘要:在字符串s1后再接上s1,形成新的字符串,再在s1中寻找是否有s2的子串,若有则为亲和串. 阅读全文
posted @ 2017-06-02 00:16 kimsimple 阅读(139) 评论(0) 推荐(0)
摘要:题意:给两个字符串,问包含这两个字符串的最小的字符串的长度 kmp返回匹配串长度 阅读全文
posted @ 2017-06-01 22:04 kimsimple 阅读(262) 评论(0) 推荐(0)
摘要:题意: 给你两个字符串,输出他们合并之后的字符串,合并的时候把A的后缀和B的前缀重叠合(或者把A的前缀和B的后缀重合)。要求合并后的串既包含A右包含B, 且使得合并后的字符串尽量短,其次是使得合并后的字符串字典序尽量小. 分析: 首先A和B合并他们一定是首尾重叠相连,要求合并后字典序最小,所以当合并 阅读全文
posted @ 2017-06-01 18:25 kimsimple 阅读(146) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include #include #include #include using namespace std; #define MaxSize 1000005 #define inf 0x3f3f3f3f #define LL long long int int n,m; int... 阅读全文
posted @ 2017-05-31 11:02 kimsimple 阅读(175) 评论(0) 推荐(0)
摘要:map巧过 经典字典树(前缀树) 第一个字典树(G++内存超限),第二个map(红黑树),对于此类问题,字典树效率优势明显 hihoCoder1014 阅读全文
posted @ 2017-05-30 12:21 kimsimple 阅读(183) 评论(0) 推荐(0)
摘要:知前序遍历与中序遍历 求后序遍历 阅读全文
posted @ 2017-05-25 17:27 kimsimple 阅读(207) 评论(0) 推荐(0)
摘要:#include #include #include #include #include using namespace std; int main() { int T, m; cin >> T; while(T--) { map >mp; string place, name; int num; ... 阅读全文
posted @ 2017-05-21 23:35 kimsimple 阅读(335) 评论(0) 推荐(0)
摘要:输入n,紧接n行,每行a,b n个气球,a,b表示从第a到第b个气球涂一次色,输出每个球最终的涂几次色 暴力超时,优化数据结构 1.树状数组 2.线段树 3.奇技淫巧 从此题discuss中看到 每个气球有两属性 作为起点的次数st 作为终点的次数ed 一共享变量sum_st记录到当前点的所有作为染 阅读全文
posted @ 2017-05-16 22:31 kimsimple 阅读(432) 评论(0) 推荐(0)
摘要:感谢:http://blog.csdn.net/mirror58229/article/details/63685884 题意:x+y=a lcm(x,y)=b 求x,y 12WCases + b 10^9 + a 10^4 所以肯定不是枚举……肯定是公式题 接下来就是转化 x+y=a x*y/gc 阅读全文
posted @ 2017-05-01 18:23 kimsimple 阅读(1400) 评论(0) 推荐(0)
摘要:HDU1541 题意: 如图,等级为0的点有1,等级为1得点有4,2 等级为2的点有3,等级为3的点有5 即即左下角的点的个数 现给你一些点(x,y),输入顺序按y升序,y相等时按x升序排列 请分别输出等级0 n-1的点的个数 分析: 暴力超时TEL,用g++提交也超时 再分析 只统计之前小于等于x 阅读全文
posted @ 2017-04-18 17:37 kimsimple 阅读(176) 评论(0) 推荐(0)
摘要:题意: 有1 2 5三数,你赋予他们各自的数量,求他们所不能组成的最小数 分析:首先想到暴力,两层循环 暴力超时,再寻他法 O(n^2) 阅读全文
posted @ 2017-04-14 15:36 kimsimple 阅读(237) 评论(0) 推荐(0)
摘要:HDU 1398 Square Coins(普通母函数 || 完全背包) 题意: 可选钱 种类17种,值分别为 i*i(i>=1&&i<=17) 求组和之和=钱数K的方案数 分析: 方法一: ///DP 完全背包问题(求装入背包) ///f[i]表示 ///打表 #include<stdio.h> 阅读全文
posted @ 2017-04-14 15:20 kimsimple 阅读(1108) 评论(0) 推荐(0)