08 2015 档案
摘要:题目链接:http://poj.org/problem?id=3468 线段树区间更新查询的样题,注意数据范围。连要更新的数据也必须是long long。
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754线段树单点更新,查询最值。代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1052贪心,田忌的策略比较复杂,仔细想一下可过。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main() {...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission...
阅读全文
摘要:整理一下最近的题解,这是三个并查集的题目,分别是:POJ 1182 食物链POJ 1611 The SuspectsPOJ 2524 Ubiquitous ReligionsPOJ 1182 食物链这个题有一个很棒的套路,那就是用一个并查集来维护三个集合内的元素,可以使这个并查集扩大n倍...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2823 Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the
阅读全文
摘要:题目链接:http://poj.org/problem?id=3974DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the s...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3068最长回文Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission...
阅读全文
摘要:这篇文章对Manacher介绍得很详细,而且很容易读懂,原文转自:http://blog.csdn.net/pi9nc/article/details/9251455一、问题描述现给定一个已知的字符串str[],现在想要在O(n)的时间复杂度之内求出一个最长的回文子字符串(正着和倒着顺序读一致)。M...
阅读全文
摘要:PasswordDescriptionAsterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly ...
阅读全文
摘要:DescriptionThe archaeologists are going to decipher a very mysterious ``language". Now, they know many language patterns; each pattern can be treated ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1358PeriodTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submissi...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3065题都懒得粘了…好的AC自动机模版真难找。也许是自己太水 1 #include 2 #include 3 #include 4 #include 5 #include 6 #in...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2406DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "de...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2066一个人的旅行Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submissi...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1879继续畅通工程Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submissi...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2503DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a ...
阅读全文
摘要:What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 17546Accepted Submiss...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3746Cyclic NacklaceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2087剪花布条Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2752DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the lit...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247Hat’s WordsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Sub...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2001DescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carb...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251统计难题Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others)Total Submissio...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1381Crazy SearchTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total S...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1686OulipoTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submissi...
阅读全文
摘要:缴获天赋树一张,决定开始点技能了。(画图的软件应该是MindJet嗯) 就算是弱校的ACMer,也要坚持自己的梦想!
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1045Fire NetTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submis...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1023Train Problem IITime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Tota...
阅读全文
摘要:题目链接:http://codeforces.com/contest/572/problem/BB. Order BookIn this task you need to process a set of stock exchange orders and use them to create or...
阅读全文
摘要:A. ArraysYou are given two arrays A and B consisting of integers, sorted in non-decreasing order. Check whether it is possible to choose k numbers in ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #in...
阅读全文
摘要:题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1633求一连串的幂,如果暴力算的话会溢出,题中会有一个求模,给出一个欧拉定理的应用:x^y % ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4911InversionTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Sub...
阅读全文
摘要:题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=26992DescriptionYou are given two integers:nandk, your task is to find the most si...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1568输出前四位的方法想不到,于是转载了方法:(原文地址http://jingyan.baidu.com/article/f3e34a128e48acf5ea65355b.html)题意:输出Fibona...
阅读全文
摘要:A - Bi-shoe and Phi-shoe Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %lluDescriptionBambo...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1695 两个区间内各取一个数,使这两个数的gcd为确定值,统计符合条件的数的对数。(认为(a,b)和(b,a)是同一对) 1 #include 2 #include 3 #include ...
阅读全文
摘要:本题数字本身是素数,并且各数位和也是素数,这样的数字在某区间内的个数。 先素数筛,再筛出各数位和是奇数的数,接着统计1-a的时候所有符合条件的数字的个数,求特定区间符合条件的数字做差即可。 代码如下: 1 #include 2 #include 3 #include 4 #includ...
阅读全文
摘要:置换群,求出循环节长度即可。 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 const int maxn = 1111; 8 int n; 9 int p[maxn];10 bool vis[maxn];11 1...
阅读全文
摘要:这道题考察了三个数论的公式定理:整数唯一分解定理:a=(p1^k1)*(p2^k2)**...*(pn^kn) (p(i)为质数)因数和公式 (已知a=(p1^k1)*(p2^k2)**...*(pn^kn)),则A的所有因子之和为:sum = (1+p1+p1^2+...p1^k1)*(1+p2+...
阅读全文
摘要:题目链接:http://poj.org/problem?id=2478好水的题啊,求欧拉函数前n项和,注意是从2开始。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #inc...
阅读全文
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4349数出n的二进制有x位1,再求2的x次幂就可以,数据不大不用优化 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 ...
阅读全文
摘要:求n个数的组合,利用二进制的0和1表示使用与不使用的两种状态可以拿来存储每一位的使用情况并且保证不会重复。代码如下: 1 #include 2 #include 3 4 using namespace std; 5 6 int main() { 7 int arr[10]; 8 ...
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4135题意:给一个区间[a,b],再给你一个数n,求在这个区间[a,b]中与n互质的数的个数。思路:这是一道数学题,如果数据范围不大的话可以直接套用欧拉函数,但是数据范围给得很大。所以用容斥原理来做。具体...
阅读全文
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5391 考的数论中的威尔逊定理,题目直接给出了威尔逊定理的表达式的语言描述。 在初等数论中,威尔逊定理给出了判定一个自然数是否为素数的充分必要条件。即:当且仅当p为素数时:( p -1 )! ≡ -1...
阅读全文
摘要:1 const int mod = 1000; 2 3 int bitpow(int x, int n) { 4 int ans = 1; 5 int t = x; 6 while(n) { 7 if(n & 1) { 8 ans ...
阅读全文

浙公网安备 33010602011771号