
[ACM]_奇思妙想
同学少年
没有什么不可能!
展开
-
hihoCoder挑战赛7 1001 正则表达式 (区间DP)
http://hihocoder.com/contest/challenge7/problem/1描述给定一个字符串,判断其是否为合法的正则表达式。 一个正则表达式定义为: 1:0是正则表达式,1也是正则表达式。 2:P和Q都是正则表达式,则PQ是正则表达式。 3:P是正则表达式,则(P)是正则表达式 4:P是正则表达式,则P*也是正则表达式 5:P和Q都是原创 2015-04-05 20:12:55 · 1842 阅读 · 0 评论 -
[ACM] SCU 1555 Inversion Sequence (线段树)
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1555输入5个数1 2 0 1 0 表示1前面有1个比它大的数,2前面有2个比它大的数…..求一个1~n的排列,比如这个就输出3 1 5 2 41前面有1个比它大的数,那么1肯定在第二位2前面有2个比它大的数,那么2肯定排在第四位,有一位被1占了。3前面有0个比它大的数,原创 2015-04-05 20:09:23 · 1413 阅读 · 0 评论 -
[ACM] CSU 1548 Design road (三分)
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1548第一次接触三分,题意和代码参考的网上的。题意:修路:从(0,0)~(x,y),n个数表示有第二行开始有n行表示有n条河,tx是河的起始位置,ty是河的宽度,有水的地方要修桥,而x,y表示修路的端点,C1表示修路每米的花费,C2表示修桥每米的花费,问你最后花费的最少金额!思路:先把有原创 2015-04-05 20:06:01 · 1591 阅读 · 0 评论 -
[ACM] CSU 1553 Good subsequence(尺取法)
题目地址:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1553给定n的数的序列,求最长连续区间满足区间内的数最大值与最小值的差(尺取法)const int maxn=10010;int num[maxn];int n,k;int MIN,MAX;int main(){ while(scanf("%d%d",&n,&原创 2015-04-05 19:49:45 · 1818 阅读 · 0 评论 -
[ACM] HDU 5135 Little Zu Chongzhi's Triangles (一堆木棍组成三角形最大面积)
Little Zu Chongzhi's TrianglesProblem DescriptionZu Chongzhi (429–500) was a prominent Chinese mathematician and astronomer during the Liu Song and Southern Qi Dynasties. Zu calculated the原创 2014-12-22 10:55:05 · 2793 阅读 · 0 评论 -
[ACM] hdu 5147 Sequence II (树状数组,前缀和,后缀和)
Sequence IIProblem DescriptionLong long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all numbers are different in原创 2014-12-21 14:59:16 · 2493 阅读 · 0 评论 -
[ACM] HDU 5139 Formula (离线处理)
FormulaProblem Descriptionf(n)=(∏i=1nin−i+1)%1000000007You are expected to write a program to calculate f(n) when a certain n is given. InputMulti test cases (about 10000原创 2014-12-07 09:49:23 · 2316 阅读 · 0 评论 -
[ACM]codeorces 488A Giga Tower (暴力枚举)
A. Giga Towertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiga Tower is the tallest and deepest building原创 2014-11-25 19:56:23 · 1811 阅读 · 0 评论 -
[ACM] HDU 5086 Revenge of Segment Tree(所有连续区间的和)
Revenge of Segment TreeProblem DescriptionIn computer science, a segment tree is a tree data structure for storing intervals, or segments. It allows querying which of the stored segments c原创 2014-11-02 10:20:51 · 2369 阅读 · 0 评论 -
[ACM] HDU 5024 Wang Xifeng's Little Plot (构造,枚举)
Wang Xifeng's Little PlotProblem Description《Dream of the Red Chamber》(also 《The Story of the Stone》) is one of the Four Great Classical Novels of Chinese literature, and it is commonly原创 2014-10-14 20:38:21 · 1590 阅读 · 0 评论 -
hiho模拟面试题2 补提交卡 (贪心,枚举)
题目:时间限制:2000ms单点时限:1000ms内存限制:256MB描述小Ho给自己定了一个宏伟的目标:连续100天每天坚持在hihoCoder上提交一个程序。100天过去了,小Ho查看自己的提交记录发现有N天因为贪玩忘记提交了。于是小Ho软磨硬泡、强忍着小Hi鄙视的眼神从小Hi那里要来M张"补提交卡"。每张"补提交卡"都可以补回一天的提交,将原创 2014-10-02 15:11:56 · 2569 阅读 · 0 评论 -
[BestCoder Round #3] hdu 4909 String (状压,计数)
StringProblem DescriptionYou hava a non-empty string which consists of lowercase English letters and may contain at most one '?'. Let's choose non-empty substring G from S (it can be G = S原创 2014-08-05 16:56:34 · 2092 阅读 · 0 评论 -
[ACM] HDU 4035 Maze (概率DP,转化方程)
MazeSpecial JudgeProblem DescriptionWhen wake up, lxhgww find himself in a huge maze.The maze consisted by N rooms and tunnels connecting these rooms. Each pair of rooms is connected b原创 2014-08-01 10:14:48 · 1788 阅读 · 0 评论 -
[ACM] ZOJ 3329 One Person Game (概率DP,有环,巧妙转化)
One Person GameTime Limit: 1 Second Memory Limit: 32768 KB Special JudgeThere is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 ha原创 2014-07-31 19:33:16 · 2340 阅读 · 0 评论 -
[ACM] POJ 3318 Matrix Multiplication (随机化算法)
Matrix MultiplicationTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16118 Accepted: 3485DescriptionYou are given three n × n matrices A, B and C. Doe原创 2014-07-28 21:20:46 · 3749 阅读 · 0 评论 -
[ACM] POJ 3061 Subsequence (尺取法)
SubsequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 8403 Accepted: 3264DescriptionA sequence of N positive integers (10 < N < 100 000), each of原创 2014-07-24 09:50:35 · 2383 阅读 · 0 评论 -
[ACM] POJ 2796 Feel Good (求序列中子序列的和与子序列中的最小数最大乘积)
Feel GoodTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 9186 Accepted: 2509Case Time Limit: 1000MS Special JudgeDescriptionBill is developi原创 2014-07-21 11:08:01 · 2899 阅读 · 0 评论