逝去的ACM经历
lMonster81
淡泊以明志,宁静以致远
展开
-
HDU4717
The Moving PointsTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1904 Accepted Submission(s): 777Problem DescriptionThere are N p转载 2017-04-12 15:17:35 · 297 阅读 · 0 评论 -
ZOJ2971
Give Me the NumberTime Limit: 2 Seconds Memory Limit: 65536 KBNumbers in English are written down in the following way (only numbers less than 109 are considered). Number abc,def,ghi is writ...原创 2017-04-13 12:45:20 · 283 阅读 · 0 评论 -
ZOJ2975
Kinds of FuwasTime Limit: 2 Seconds Memory Limit: 65536 KBIn the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China as well as becoming a fe...原创 2017-04-13 13:01:32 · 300 阅读 · 0 评论 -
快速幂运算
如果我们要求X^n次方;当n很大的时候;会GG;这个时候就会用到快速幂算法了, 顾名思义, 快速幂, 快速求幂。 因为任何一个数都可以用2进制表示。比如9 = 2 ^3 + 2^0;7 = 2^2 + 2^ 1 + 2 ^0;所以我们可以把n看成 n = 2 ^ k1 + 2 ^ k2 + 2^k3...... 这样来表示。当然我们同样可以把x用这样表示。即...原创 2017-04-14 17:30:40 · 471 阅读 · 0 评论 -
poj1961 KMP(循环节)
PeriodTime Limit: 3000MS Memory Limit: 30000K Total Submissions: 17696 Accepted: 8523 DescriptionFor each prefix of a given string S with N characters (each character has an AS...原创 2017-04-15 16:08:37 · 219 阅读 · 0 评论 -
HDU3746(KMP求循环节)
Cyclic Nacklace Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8456 Accepted Submission(s): 3640 Problem DescriptionCC always ...原创 2017-04-15 15:59:15 · 253 阅读 · 0 评论 -
HDU 2087
KMP的水题需要注意的就是每当匹配成功了一个模式串时,必须要从模式串的0位置开始从新匹配。根据题意,主串匹配成功的后,这一段就会被减去。所以在主串中该位置的前缀和后缀都没有,不能使用next数组预先比较。 由于该题的数据范围不大,我就用了两种方法,暴力和KMP。原题剪花布条Time Limit: 1000/1000 MS (Java/Others) Memo...原创 2017-04-15 15:50:27 · 206 阅读 · 0 评论 -
KMP常用算法模板
1.求主串中模式串出现了几次例题 HDU1686 #include<cstdio>#include<cstring>using namespace std;#define EPS 1e-7#define clr(x) memset(x, 0, sizeof(x))#define long long ll#define double db#def...原创 2017-04-15 15:29:47 · 263 阅读 · 0 评论 -
UESTC - 481(2011四川省省赛水题)
Apparent MagnitudeEditTime Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)The scale now used to indicate magnitude originates in the Hellenistic practice of dividi...原创 2017-04-16 19:48:03 · 325 阅读 · 0 评论 -
HDU1176(DP)
免费馅饼 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 47552 Accepted Submission(s): 16440 Problem Description都说天上不会掉馅饼,但有一天gameb...原创 2017-04-17 23:18:01 · 170 阅读 · 0 评论 -
周期串Uva455 紫书P57 3-4
A character string is said to have period k if it can be formed by concatenating one or more repetitionsof another string of length k. For example, the string ”abcabcabcabc” has period 3, since it i...原创 2017-04-14 18:11:18 · 251 阅读 · 0 评论 -
ZOJ2966
Build The Electric SystemTime Limit: 2 Seconds Memory Limit: 65536 KBIn last winter, there was a big snow storm in South China. The electric system was damaged seriously. Lots of power lines...原创 2017-04-13 12:37:07 · 207 阅读 · 0 评论 -
new和malloc的区别
1. malloc()函数1.1 malloc的全称是memory allocation,中文叫动态内存分配。原型:extern void *malloc(unsigned int num_bytes); 说明:分配长度为num_bytes字节的内存块。如果分配成功则返回指向被分配内存的指针,分配失败返回空指针NULL。当内存不再使用时,应使用free()函数将内存块释放。1.2 voi转载 2017-10-09 09:48:50 · 225 阅读 · 0 评论 -
UESTC486(2011四川省省赛)
Good MorningEdit Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)Sam loves Lily very much that he shows his love to her through all kinds of ways. This morning...原创 2017-04-16 19:53:46 · 243 阅读 · 0 评论 -
简单排列习题 紫书P35
用1,2,3,...9组成3个3位数abc, def, ghi;每个数字恰好用一次,要求 abc:def :ghi = 1: 2 : 3;按照abc : def : ghi的格式输出。通常想到的思路为枚举9个数, 然后再去判断;这样的话复杂度很大;枚举消耗的时间相对来说较大,当枚举的范围过大时,我们可以根据条件减小枚举范围;题中给出了一个等式;根据这个等式我们可以先枚举出abc的值...原创 2017-04-14 18:20:00 · 230 阅读 · 0 评论 -
ZOJ2969
Easy TaskTime Limit: 2 Seconds Memory Limit: 65536 KBCalculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))' to denote its derivation. We use x^n t...原创 2017-04-13 12:40:32 · 212 阅读 · 0 评论 -
ZOJ2965
Accurately Say "CocaCola"!Time Limit: 2 Seconds Memory Limit: 65536 KBIn a party held by CocaCola company, several students stand in a circle and play a game.One of them is selected as the...原创 2017-04-13 11:18:00 · 254 阅读 · 0 评论 -
hdu4727题意很难搞懂
The Number Off of FFF X soldiers from the famous " *FFF* army" is standing in a line, from left to right.You, as the captain of *FFF*, decides to have a "number off", that is, each soldier, fr...原创 2017-04-10 16:02:05 · 352 阅读 · 0 评论 -
HDU4720(简单几何)
Naive and Silly Muggles Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1123 Accepted Submission(s): 749 Problem DescriptionThr...原创 2017-04-10 16:34:44 · 344 阅读 · 0 评论 -
二分与三分
二分题型最明显的有两种:求最大值的最小化,或最小值的最大化。一般地,对于一个求最值的问题,如果不方便直接求解的话同时这个最值的趋向是单调的,就可以二分枚举。此时二分一般加上dp或贪心的check()即可得知接下来的答案区间。下面分别讨论最常见的两种。 最大值最小化:对于此类问题,我们设答案的区间为[l,r]那么当l=r时,显然区间只有一个值,这就是我们要的结果...转载 2017-04-10 17:29:27 · 278 阅读 · 0 评论 -
HDU4726
Kia's Calculation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3601 Accepted Submission(s): 763 Problem DescriptionDoctor Gh...原创 2017-04-12 16:34:59 · 233 阅读 · 0 评论 -
HDU2084(数字三角dp)
数塔 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 43097 Accepted Submission(s): 25486 Problem Description在讲述DP算法的时候,一个经典的例子就是数...原创 2017-04-17 23:10:12 · 358 阅读 · 0 评论