2012年5月2日

hdu GCD

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2588ans=sum(elur(n/q))(q>=m,q|n);用搜索求大于等于m且能整除n的数q 阅读全文

posted @ 2012-05-02 20:57 Goal 阅读(202) 评论(0) 推荐(0) 编辑

2012年4月27日

线段树

摘要: Problem 1492 地震预测 Accept: 302Submit: 1633Time Limit: 1500 mSecMemory Limit : 32768 KB Problem Description怀特先生是一名研究地震的科学家,最近他发现如果知道某一段时间内的地壳震动能量采样的最小波动值之和,可以有效地预测大地震的发生。假设已知一段时间的n次地壳震动能量的采样值为a1,a2,…an,那么第i 次采样的最小波动值为min{|ai-aj| | i<j<=n},即第i 次采样的最小波动值是其后n-i次采样值与第i次采样值之差的绝对值中最小的值,特别地,第n次采样的最小波动值 阅读全文

posted @ 2012-04-27 18:34 Goal 阅读(384) 评论(0) 推荐(0) 编辑

2012年4月11日

栈的应用

摘要: Largest Rectangle in a HistogramTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10896Accepted: 3456DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure 阅读全文

posted @ 2012-04-11 16:44 Goal 阅读(184) 评论(0) 推荐(0) 编辑

2012年4月10日

KM算法

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3488KM算法: http://blog.csdn.net/yuhailin060/article/details/5865362解释的很清楚,当每个点的出度和入度都为一是就可以用KM算法 阅读全文

posted @ 2012-04-10 19:07 Goal 阅读(374) 评论(0) 推荐(0) 编辑

2012年4月7日

竟然是trie

摘要: Consecutive SumTime Limit: 1 SecMemory Limit: 128 MBSubmit: 42Solved: 3[Submit][Status][Web Board]DescriptionLittle Jimmy is learning how to add integers. As in decimal the digits are 0 to 9, it makes a bit hard for him to understand the summation of all pair of digits. Since addition of numbers req 阅读全文

posted @ 2012-04-07 21:31 Goal 阅读(392) 评论(0) 推荐(0) 编辑

cf

摘要: http://codeforces.com/contest/173/problem/A第一次做cf,感觉题目很好,贴下最简单的题目的代码View Code #include <iostream>#include <cstring>using namespace std;char s1[1100],s2[1100];int cal(char a,char b){ if(a==b) return 0; if(a=='R'&&b=='S') return 1; if(a=='S'&&b==' 阅读全文

posted @ 2012-04-07 21:18 Goal 阅读(167) 评论(0) 推荐(0) 编辑

spfa 反向建边 两次求最短路 Toll Management

摘要: Toll ManagementTime Limit: 1 SecMemory Limit: 128 MBSubmit: 43Solved: 16[Submit][Status][Web Board]DescriptionIn Dhaka there are too many vehicles. So, the result is well known, yes, traffic jam. So, mostly people have to spend quite a time in the roads to go from one place to another.Now, the stude 阅读全文

posted @ 2012-04-07 15:54 Goal 阅读(255) 评论(0) 推荐(0) 编辑

树状数组的应用 Mega Inversions

摘要: Mega InversionsTime Limit: 1 SecMemory Limit: 128 MBSubmit: 84Solved: 17[Submit][Status][Web Board]DescriptionThe n^2 upper bound for any sorting algorithm is easy to obtain: just take two elements that are misplaced with respect to each other and swap them. Conrad conceived an algorithm that procee 阅读全文

posted @ 2012-04-07 13:51 Goal 阅读(416) 评论(0) 推荐(0) 编辑

Robots on a grid bfs() dp

摘要: Robots on a gridTime Limit: 1 SecMemory Limit: 128 MBSubmit: 272Solved: 43[Submit][Status][Web Board]DescriptionYou have recently made a grid traversing robot that can finnd its way from the top left corner of a grid to the bottom right corner. However, you had forgotten all your AI programming skil 阅读全文

posted @ 2012-04-07 10:27 Goal 阅读(320) 评论(0) 推荐(0) 编辑

2012年4月6日

zju 简单计算题

摘要: A - Clock Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3313DescriptionIt is known that, in one day the hour hand and the minute hand of a clock meet 22 times. But in one day, how long is the time that the angle between the hour hand and the min... 阅读全文

posted @ 2012-04-06 19:10 Goal 阅读(338) 评论(0) 推荐(0) 编辑

导航