- 博客(42)
- 资源 (23)
- 收藏
- 关注
转载 一位ACMer过来人的心得
刻苦的训练我打算最后稍微提一下。主要说后者:什么是有效地训练? 我想说下我的理解。 很多ACMer入门的时候,都被告知:要多做题,做个500多道就变牛了。其实,这既不是充分条件、也不会是必要条件。 我觉得一般情况下,对于我们普通学校的大学生,各方面能力的差距不会太大,在这种情况下,训练和学习的方法尤为重要。 其实,500题
2014-12-06 13:21:59 608
原创 HDU5142 NPY and arithmetic progression && BestCoder Round #23 1002
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5143解题思路:BestCoder官方题解:可以发现等差数列只有(123,234,1234和长度>=3的常数列),如果选择非常数列(123,234,1234)数量大于等于3,可以变为三个或4个常数列,例如(123,123,123)变为(111,222,333)。所以从0-2枚举选择非
2014-12-27 16:44:24 671
原创 HDU5147 Sequence II && BestCoder Round #23 1002
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5147解题思路:BestCoder官方题解:要统计四元组的数量我们可以通过枚举c,然后统计区间[1,c-1]有多少二元组(a,b)满足ab且AaAb,以及统计出区间[c+1,n]有多少d满足AcAd,根据乘法原理,把这两项乘起来就可以统计到答案里了.然后我们来处理子问题:区间[1,
2014-12-27 14:46:41 382
原创 HDU5146 Sequence &&BestCoder Round #23 1001
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5146解题思路:BestCoder官方题解:判断给定的数列是否满足下标为奇数的和等于下标位偶数的和并且不回文.分别判断两个性质是否都满足就可以了.时间复杂度O(n).AC代码:#include#includeusing namespace std;int
2014-12-27 14:42:35 423
原创 HDU5144 NPY and shot && BestCoder Round #22 1003
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5144解题思路:BestCoder官方题解:这是一个高一物理题。扔的距离与投掷角度的函数,符合单峰性质,所以三分角度就行了。当角度为θ时,设横向速度为vx=cos(θ)*v0,纵向速度为vy=sin(θ)*v0,则扔的距离为: (vy/g+sqrt((vy*vy/(g*2)+h)*
2014-12-22 18:24:18 554
原创 HDU5142 NPY and FFT && BestCoder Round #22 1001
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5142解题思路:BestCoder官方题解:这个题直接模拟就行,把数表示成二进制,然后翻转一下,再倒着算出来,就行了AC代码:#include#includeusing namespace std;int main(){ int n,T; sc
2014-12-22 18:19:30 844
原创 HDU 1171 Number Sequence(KMP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1711解题思路:不想说我对kmp算法懂了多少,但至少理解了。能敲出代码。给你几个大牛的博客,看看他们对kmp的理解:http://kb.cnblogs.com/page/176818/http://www.cnblogs.com/dolphin0520/archive
2014-12-14 20:44:54 708
原创 Codeforces 494 A. Treasure && Codeforces Round #282 (Div. 1)
题目链接:http://codeforces.com/problemset/problem/494/A解题思路:Codeforces官方题解:Consider a string consisting of '(' and ')' characters. Let's build the following sequence from this string:a
2014-12-14 11:00:13 662
原创 Codeforces 495 B. Modular Equations && Codeforces Round #282 (Div. 2)
题目链接:http://codeforces.com/problemset/problem/495/B解题思路:Codeforces官方题解:If a b then there is no answer since .If a = b then x can be any integer larger than a. so there are infinite n
2014-12-14 10:53:24 1009
原创 Codeforces 495 A. Digital Counterr && Codeforces Round #282 (Div. 2)
题目链接:http://codeforces.com/problemset/problem/495/A解题思路:Codeforces官方题解:For each digit x you can count the number of digits y that because of some broken sticks x is shown instead of y by
2014-12-14 10:48:32 591
原创 HDU2072 单词数
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2072解题思路:找出不同的单词一共有多少个,虽然这题现在看起来很简单,但是初学时可算是不知wrong了多少次呀.AC代码:#include#include#includeusing namespace std;int main(){ char s[100
2014-12-12 23:56:55 2422
转载 TC(SRM)和CF入门教程for ACMer
一、TC基本介绍TC的网址www.topcoder.com/tc,我们一般提到TC的时候是特指其中的Single Round Match(SRM)。SRM的规则总结起来就是一句话:75分钟做完3道难度递增的题。TC的每个用户(handle)都有自己的积分(rating),从0-3000+不等。成绩越好,分数越高。积分与颜色的对应为:白色——未参赛(unrated);灰色——0~899;绿色——90
2014-12-11 21:47:11 736
原创 UVA12627 Erratic Expansion
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4352解题思路:找规律题。然后用递归求解。AC代码:#include#include#includeusing namespace std;typedef
2014-12-08 08:05:33 465
原创 HDU1028 Ignatius and the Princess III(母函数模板)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1028解题思路:标准的母函数模板题。AC代码:#include#includeusing namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { int i
2014-12-08 08:01:31 726 3
原创 POJ1298 The Hardest Problem Ever
题目链接:http://poj.org/problem?id=1298解题思路:水题,直接上代码。AC代码:#include#include#include#includeusing namespace std;int main(){ string a,b,c; while(getline(cin,a)) { if
2014-12-08 07:54:29 339
原创 POJ2365 Rope
题目链接:http://poj.org/problem?id=2365解题思路:做这题时,真是郁闷死了,明明是到水题,我还wrong了这么多次。首先,一开始我把半径定义成int型,心想后面总是会乘以一个double型pi,也会变成double型,结果就因为这,一直wrong。而且这题还有一个问题就是输出必须要%f型,不然你也会一直wrong。这题真是受够了。AC代码:
2014-12-08 07:48:21 452
原创 POJ2105 IP Address
题目链接:http://poj.org/problem?id=2105解题思路:水题,直接上代码。AC代码:#include#include#includeusing namespace std;int main(){ int T; scanf("%d",&T); while(T--) { char a[35
2014-12-08 07:46:23 376
原创 POJ2590 Steps
题目链接:http://poj.org/problem?id=2590解题思路:水题,找规律。AC代码:#include#include#includeusing namespace std;int main(){ int T; scanf("%d",&T); while(T--) { int x,y,ste
2014-12-08 07:44:01 375
原创 POJ1218 THE DRUNK JAILER
题目链接:http://poj.org/problem?id=1218解题思路:水题,直接暴力。AC代码:#include#include#includeusing namespace std;int main(){ int T; scanf("%d",&T); while(T--) { int i,j,n,
2014-12-08 07:42:06 345
原创 POJ 1003 Hangover
题目链接:http://poj.org/problem?id=1003解题思路:水题,直接上代码.AC代码:#include#includeusing namespace std;int main(){ double n; while(scanf("%lf",&n)!=EOF) { if(n==0.00)
2014-12-08 07:39:28 516 2
原创 HDU5139 Formula && BestCoder Round #21 1002
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5139解题思路:BestCoder官方题解:找规律f(1)=1f(2)=1*1*2=(1)*(1*2)=1!*2!f(3)=1*1*1*2*2*3=(1)*(1*2)*(1*2*3)=1!*2!*3!式子可以简化为 f(n)=∏i=1n(n!)%MOD,直接打表不行,会超内
2014-12-08 07:29:31 410
原创 HDU5138 CET-6 test && BestCoder Round #21 1001
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5138解题思路:BestCoder官方题解:直接从1到n枚举i,判断n-i是否与1,2,4,7,15相等复杂度o(n)水题,直接上代码:AC代码:#include#includeusing namespace std;int main(){
2014-12-08 07:24:52 473
原创 POJ 1979 Red and Black(搜索)
题目链接:http://poj.org/problem?id=1979解题思路:搜索的水题,第一次用bfs做题,感觉这种水题,练不熟悉的东西最好啦。AC代码:#include#include#includeusing namespace std;int n,m,ans;char maze[25][25];int dx[]={0,-1,0,1},dy[]
2014-12-06 04:06:57 468 2
原创 POJ2229 Sumsets
题目链接:http://poj.org/problem?id=2229解题思路:其实这题也能有母函数做,只不过数据量太大了,超了时,不信,你用1000000.跑跑看,多长时间才能出结果。所以这题只能找规律了。如果i为奇数,肯定有一个1,把f[i-1]的每一种情况加一个1就得到fi,,所以f[i]=f[i-1]如果i为偶数,如果有1,至少有两个,则f[i-2]的每
2014-12-06 02:19:56 513 2
原创 POJ2215 Parliament
题目链接:http://poj.org/problem?id=2215解题思路:给你一个矩阵,然后让你求矩阵中任意矩形范围内的和。(英语不好,果然是硬伤!!!)AC代码:#include#includeusing namespace std;int maze[1010][1010];int main(){ int T; scanf("%d",&
2014-12-06 01:47:05 651
原创 POJ1922 Ride to School
题目链接:http://poj.org/problem?id=1922解题思路:简单的数学题。不用考虑中间的相遇过程,因为相遇了,前面的时间过了就是过了,所以直接看谁先到达学校用的时间最短就行了。AC代码:#include#include#include#define INF 0xfffffffusing namespace std;int main()
2014-12-06 01:17:00 390
原创 POJ1163 The Triangle
题目链接:http://poj.org/problem?id=1163解题思路:简单的dp。AC代码:#include#include#includeusing namespace std;int main(){ int n; int dp[110][110]; int maze[110][110]; while(scanf
2014-12-06 00:43:39 308
原创 HDU1027 Ignatius and the Princess II
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1027解题思路:求第m个全排列。直接用上STL里面的next_permutation库函数即可。AC代码:#include#include#includeusing namespace std;int main(){ int n,m; while
2014-12-05 23:55:16 385
原创 HDU1257 最少拦截系统
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1257解题思路:最长递增子序列,感觉只是把最长公共递增子序列变了一个形而已,其实实质都是一样的。AC代码:#include#include#includeusing namespace std;int main(){ int n; while(s
2014-12-04 20:08:09 680 3
原创 HDU1423 Greatest Common Increasing Subsequence
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1423解题思路:最长公共递增子序列,如果不懂的话,还是看这个人的讲解:http://www.cnblogs.com/xkfz007/archive/2012/10/17/2728728.htmlAC代码:#include#include#includeusing n
2014-12-04 19:43:08 329
原创 HDU1159 Common Subsequence
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1159解题思路:基本的最长公共子序列,不懂的请看这个人的博客:http://www.cnblogs.com/xkfz007/archive/2012/10/17/2728728.htmlAC代码:#include#include#includeusing names
2014-12-04 19:39:04 392
原创 POJ1125 Stockbroker Grapevine
题目链接:http://poj.org/problem?id=1125解题思路:没办法,英语太烂了,先上翻译,理解题意。(有道翻译)股票经纪人小道消息描述股票经纪人已知反应过度的谣言。你已经感染发展传播虚假信息的方法在股票经纪人给你的雇主在股票市场的战术优势。为了取得最大的效果,你必须传播谣言的最快的方式。不幸的是,股票经纪人只信任信息来自他们的“可
2014-12-04 11:50:08 367
原创 HDU 2544 最短路
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544解题思路:虽然暑假做了很多最短路径的问题,但是一阵子没碰,多少还是有点生疏了,于是整理了三种有关最短路径的算法,供大家参考。dijkstra算法以及floyd算法如果不熟悉的人,请先看看这个大牛的博客:http://blog.csdn.net/fengchaokobe/articl
2014-12-04 09:33:02 377
原创 HDU1709 The Balance(母函数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1709解题思路:有了上次对母函数的理解,这道题应该不难吧。AC代码:#include#include#includeusing namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) {
2014-12-04 09:29:34 358
原创 HDU1085 Holding Bin-Laden Captive!(母函数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085解题思路:一道母函数的题目,至于有关母函数详细的讲解,请看这个人的博客:http://www.wutianqi.com/?p=596至于我对母函数的理解吧,个人认为其实还是很简单的,代码里有备注。AC代码:#include#include#include
2014-12-04 09:18:04 352
原创 HDU1102 Constructing Roads(最小生成树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1102解题思路:简单的最小生成树的应用,不过,按我以前的风格,会加个提前跳出循环的判断,但是这题不行,因为题目给出的两个点联通,有可能重复。AC代码:#include#include#include#includeusing namespace std
2014-12-02 07:45:02 586 2
原创 HDU5101 Select(二分)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5101解题思路:BestCoder官方题解:题目大意:给定一些集合,选择两个来自不同集合的数,加和大于k,问有多少种选择方案。解题思路:答案=从所有数中选择的两个加和大于k的数的方案数-在同一个集合中选择的两个加和大于k的数的方案数而对于同一个集合中选择的两个加和大于k的方案
2014-12-01 20:12:49 442
原创 二维几何基础模板(三)
一、通过圆心角求坐标的函数struct Circle{ Point c; double r; Circle(Point c,double r):c(c),r(r) {} Point point(double a) { return Point(c.x+cos(a)*r,c.y+sin(s)*r); }};
2014-12-01 16:31:51 579
原创 HDU5122 K.Bro Sorting
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112解题思路:坑死了,想了各种排序,结果发现只需要:对于每一个数只要后面的数有比它小就要更换一次,然后sum++就行了。AC代码:#include#includeusing namespace std;int a[1000010];int main(){
2014-12-01 10:51:54 690
原创 HDU 5112 A Curious Matt
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5112解题思路:求出最大的速度。AC代码:#include#include#include#includeusing namespace std;struct node{ int t,s; double v;}no[10010];boo
2014-12-01 10:36:56 696
程序员面试宝典 第5版
2018-09-17
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人