题解心得
文章平均质量分 78
CFhM_R
所谓的光辉岁月,不是那些闪亮的日子,而是无人问津时,你对梦想的坚持
展开
-
CFhM xjb training 题解
第二期第四次每周训练题解 Authored by CFhM_R, 2011 - 2017, All Rights Reserved. [CFhM_R@outlook.com](my mail)第二期第四次每周训练题解A-Moon Safari medium-数论B-Number Busters-推公式C-ZYB loves Xor I-分治D-Wavy numbers-Q神代原创 2017-03-26 20:57:22 · 1149 阅读 · 0 评论 -
【hdu2203】亲和串——用strstr的字符串匹配
题目:亲和串Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11337 Accepted Submission(s): 5120Problem Description人随着岁数的增长是越大越聪明原创 2016-04-16 22:04:30 · 468 阅读 · 0 评论 -
【hdu2087】剪花布条——KMP
题目:剪花布条Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14376 Accepted Submission(s): 9089Problem Description一块花布条,里面有些图案,原创 2016-04-16 21:58:44 · 534 阅读 · 0 评论 -
【hdu1867】A + B for you again——KMP
题目:A + B for you againTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5914 Accepted Submission(s): 1463Problem Description原创 2016-04-16 21:33:13 · 401 阅读 · 0 评论 -
【hdu1711】Number Sequence——KMP
题目:Number SequenceTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19270 Accepted Submission(s): 8280Problem DescriptionG原创 2016-04-16 21:17:15 · 367 阅读 · 0 评论 -
【hdu1358】Period——KMP
题目:PeriodTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5732 Accepted Submission(s): 2766Problem DescriptionFor each pre原创 2016-04-16 20:52:29 · 394 阅读 · 0 评论 -
【codeforces 1A】Theatre Square——数学,水
题目:A. Theatre Squaretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTheatre Square in the cap原创 2016-04-25 15:10:54 · 593 阅读 · 0 评论 -
【codeforces 1B】Spreadsheets——模拟,水
题目:B. Spreadsheetstime limit per test10 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputIn the popular spreadsheet原创 2016-04-25 23:17:29 · 650 阅读 · 0 评论 -
【hdu2298】Toxophily——三分+二分
题目:ToxophilyTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1603 Accepted Submission(s): 853Problem DescriptionThe recrea原创 2016-03-14 18:24:39 · 404 阅读 · 0 评论 -
【hdu1969】Pie——二分
题目:PieTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7795 Accepted Submission(s): 2889Problem DescriptionMy birthday is原创 2016-03-13 23:48:47 · 410 阅读 · 0 评论 -
【hdu2199】Can you solve this equation?——二分
题目:Can you solve this equation?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15110 Accepted Submission(s): 6739Problem Desc原创 2016-03-13 22:40:01 · 361 阅读 · 0 评论 -
【hdu2899】Strange fuction——三分
题目:Strange fuctionTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5360 Accepted Submission(s): 3832Problem DescriptionNow原创 2016-03-13 22:36:33 · 479 阅读 · 0 评论 -
【hdu1501】zipper——dfs
题目:ZipperTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8645 Accepted Submission(s): 3061Problem DescriptionGiven three原创 2016-02-26 22:42:36 · 468 阅读 · 0 评论 -
【hdu1010】Tempter of the Bone——dfs
题目:Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 98266 Accepted Submission(s): 26642Problem Description原创 2016-02-26 20:09:36 · 372 阅读 · 0 评论 -
【hdu2594】Simpsons’ Hidden Talents——KMP
题目:Simpsons’ Hidden TalentsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5599 Accepted Submission(s): 2025Problem Descripti原创 2016-04-16 22:34:57 · 376 阅读 · 0 评论 -
【hdu3336】——KMP&&dp
题目:Count the stringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7511 Accepted Submission(s): 3479Problem DescriptionIt原创 2016-04-16 22:39:39 · 367 阅读 · 0 评论 -
【poj2406】Power Strings——KMP
题目:Power StringsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 41220 Accepted: 17140DescriptionGiven two strings a and b we define a*b to be thei原创 2016-04-16 22:44:32 · 449 阅读 · 0 评论 -
2016BITCS小学期程序设计简要题解
2016BITCS小学期程序设计简要题解球体问题 By CFhM_R设球缺的高为h,由于题目中说明d>max(R1,R2)且d<(R1+R2),所以两个球“镶嵌”而损失的体积不会超过球体的1/21/2, 因此直接积分可以得出球的体积公式。正视球缺,设由于“镶嵌”损失的劣弧所对的圆心角为θ\theta ,考虑球表面积的积分方法,对θ\theta取值限定范围易得S=2πRhS=2\pi Rh。注意本题的原创 2016-09-28 15:58:24 · 1557 阅读 · 0 评论 -
【codeforces709C】Letters Cyclic Shift——小水题
题目:点击进入描述:给一个字符串,要求把它的一个非空子串的所有字母变成字母表之前的一个字母,a变成z,求一个这样变换之后字典序最小的串。题解:前面的a和后面的a不用变,变中间的一部分即可,小贪心。注意非空,所以一开始检测a的时候如果全是a也要变一个。代码:#pragma comment(linker, "/STACK:1024000000,1024000000")#include <bits/st原创 2016-08-26 21:12:14 · 955 阅读 · 0 评论 -
【codeforces709B】 Checkpoints——小水题
题目:点击进入描述:给数轴上的n个点以及你的位置a,要求你走过n - 1个点,求最少的路程长度。题解:n-1个点无非是0~n-2或者1~n-1,贪心就可以知道尽量减少折返的路是最优解,这样问题就变成了从a去往哪一个端点再遍历全程最短,讨论即可。注意一开始对坐标排个序。代码:#pragma comment(linker, "/STACK:1024000000,1024000000")#include原创 2016-08-26 21:08:08 · 683 阅读 · 0 评论 -
【codeforces709A】Juicer——小水题
题目:点击进入描述:给一列数,按顺序读入,超过b的不读,其他的累加,一旦超过d累加一次答案,求最终答案题解:敢写敢过 代码:#pragma comment(linker, "/STACK:1024000000,1024000000")#include <ctime>#include <cstdio>#include <cstring>#include <cmath>#include <cl原创 2016-08-26 21:00:10 · 1207 阅读 · 0 评论 -
【hihocoder1082】然而沼跃鱼早就看穿了一切——字符串
题目:点击进入描述:给出若干行字符串,将每个串中的模式串(不分大小写)替换成目标串并输出。题解:题目很简单,关键在于如何优雅的实现,这里给出一些小的tips。 花式读入,一行,识别或不是别空格 string.find()方法,第一个参数是模式串,第二个参数是匹配的起始位置,返回的是第一个满足的位置,如果匹配不到,返回string::npos代码:#pragma comment(linker,原创 2016-08-24 19:41:36 · 580 阅读 · 0 评论 -
【hihocoder1051】补提交卡——贪心
题目:点击进入描述:一个1到100的数列有n个地方是断开的,现给出这n个位置以及一个数m,表示可以使m个位置连续,求可以得到的最长的连续区间的长度,n个位置按照升序给出。题解:必须使这m个位置连续地消除才能使最终长度最长,所以直接枚举这m个位置的左端点即可。代码:#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cti原创 2016-08-24 18:09:32 · 514 阅读 · 0 评论 -
【hihocoder1039】字符消除——模拟
题目: 点击进入描述:一个类似祖玛的字符串游戏,只有ABC三种字母,要求添加一个字母,使最后消除的字母最多,字符串长度不超过100.题解:枚举每一个位置分别加入三种字母进行消除,ans记录最大结果。 枚举是要<=len,因为可以加入的位置是 第一个字符之前、最后一个字符之后以及相邻两个字符之间原创 2016-08-24 17:17:30 · 607 阅读 · 0 评论 -
【hdu3038】
题目:描述:题解:代码:#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 2e5 + 5;int fa[maxn], sum[maxn];int find(int x){ if(fa[x] == -1) return x; int tmp原创 2016-07-19 10:22:10 · 866 阅读 · 0 评论 -
【hdu5747】Aaronson——popcount
题目: 题目链接描述:问一个数n可以被2的1到m次方表示的最小代价,使用一次2^k就带来1的代价。 n、m的范围都是1e9。题解:使用__builtin_popcount函数统计n中有多少个1(二进制),可以知道m不超过30。由于超过m的部分没法一次表示,所以减去,再加上n / 2^m即可。代码:#include <cstdio>#include <cstring>#include <cmat原创 2016-07-26 16:29:55 · 653 阅读 · 0 评论 -
【poj2886】Who Gets the Most Candies?——线段树
有N个小孩围坐成一圈(N<=500000),顺时针从1到N标号,第i个小孩有一个val[i]。多组用例,每次给定N,K,表示从第K个小孩开始,依次退出圆圈,下一个小孩的位置由val[k]指定,val>0时表示从这一次出圈的小孩的逆时针方向第val个,否则顺时针(此时已经不算出圈的小孩)。第p个出圈的小孩可以获得p的约数个糖果。每组用例给出每个小孩的名字和val值,求拿到最多的糖果原创 2016-06-13 16:40:25 · 579 阅读 · 0 评论 -
【hdu1394】Minimum Inversion Number——逆序对
题目: C - Minimum Inversion Number Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1394 Description The inversion number of a given num原创 2016-06-04 12:07:01 · 539 阅读 · 0 评论 -
【hdu3635】Dragon Balls —— 并查集
题目: Dragon Balls Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5393 Accepted Submission(s): 2036 Problem Description Five原创 2016-05-31 18:27:40 · 636 阅读 · 0 评论 -
【poj3321】Apple Tree——树状数组&DFS
【poj3321】Apple Tree——树状数组&DFS##include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 100005;struct edge{ int v,nxt;}e[maxn];int head[maxn],c[maxn],low[m原创 2016-05-29 14:24:39 · 474 阅读 · 0 评论 -
【hdu5015】233 Matrix——矩阵快速幂
题目:233 MatrixTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1588 Accepted Submission(s): 939Problem DescriptionIn our原创 2016-02-26 16:39:03 · 871 阅读 · 0 评论 -
【hdu2675】Equation Again——二分
题目:Equation AgainTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1470 Accepted Submission(s): 458Problem DescriptionThis原创 2016-02-26 16:29:01 · 785 阅读 · 0 评论 -
【hdu2289】Cup——二分
题目:CupTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6303 Accepted Submission(s): 1994Problem DescriptionThe WHU ACM Tea原创 2016-02-26 16:24:02 · 391 阅读 · 0 评论 -
【hdu1198】Farm Irrigation——并查集
Problem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these squares. Different square h原创 2016-02-24 23:23:42 · 404 阅读 · 0 评论 -
【hdu2546】饭卡——01背包
题目:饭卡Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18995 Accepted Submission(s): 6644Problem Description电子科大本部食堂的饭卡有一种很原创 2016-03-09 23:53:25 · 413 阅读 · 0 评论 -
【hdu1203】I NEED A OFFER!——01背包
题目:I NEED A OFFER!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 22398 Accepted Submission(s): 8957Problem DescriptionSp原创 2016-03-09 23:44:15 · 333 阅读 · 0 评论 -
【poj1258】Agri-Net——Kruskal
题目:Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 48503 Accepted: 20093DescriptionFarmer John has been elected mayor of his town! O原创 2016-03-19 23:11:06 · 485 阅读 · 0 评论 -
【hdu1242】Rescue——bfs+小根堆
题目:RescueTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24209 Accepted Submission(s): 8538Problem DescriptionAngel was c原创 2016-03-31 15:25:20 · 442 阅读 · 0 评论 -
【hdu2955】Robberies——01背包
题目:RobberiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18298 Accepted Submission(s): 6769Problem DescriptionThe aspi原创 2016-03-08 11:23:14 · 630 阅读 · 0 评论 -
【hdu1712】ACboy needs your help——分组背包
题目:ACboy needs your helpTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5819 Accepted Submission(s): 3177Problem Description原创 2016-03-08 10:48:51 · 413 阅读 · 0 评论