2013长沙网赛E题Travel by Bike】的更多相关文章

题目链接:http://acm.zju.edu.cn/changsha/showProblem.do?problemId=26 题意:一个人从一个地方到另一个地方,长度为L,每小时速度为speed,周一到周五每天最多走8个小时,周末最多走4个小时,给出这个人出发的时间,问周几到达. 分析:水题,但是有个地方要注意,刚好是周期的倍数的时候,应该是当前天的前一天. AC代码: #include<stdio.h> #include<string.h> ]; ][]={"Mond…
Hypersphere Time Limit: 1 Second       Memory Limit: 32768 KB In the world of k-dimension, there's a large hypersphere made by mysterious metal. People in the world of k-dimension are performing a ceremony to worship the goddess of dimension. They ar…
第一年参加现场赛,比赛的时候就A了这一道,基本全场都A的签到题竟然A不出来,结果题目重现的时候1A,好受打击 ORZ..... 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4800 题目大意:给定C(3,N)支队伍之间对战的获胜概率,再给定一个序列存放队伍编号,每次获胜之后可以选择和当前战胜的对手换队伍.问按给定序列依次挑战全部胜利的最大概率. 解题思路:状压DP dp[i][j]表示使用队伍i从编号j开始挑战全胜的概率,ai[i]表示i位置的队…
思路:这题对于其他能退出所有值的情况比较好像,唯一不能确定的是XXOXXOXXOXX这个形式的序列,其中XX表示未知,O表示已知. 我们令num[1]=0,那么num[4]=sum[3]-sum[2]+num[1]; 可以递推,num[i]=sum[i-1]-sum[i-2]+num[i-3],(i%3==1). 这样求出来的每个num值就是相对于num[1]的值. 假使某个num[i]<0,表示第i个数相对于num[1]为负数,题目要求每个数都大于等于0,所以num[1]>=(-num[i]…
比赛的时候就预感到这题能出,但是会耗时比较多.结果最后是出了,但是有更简单的题没出. 是不是错误的决策呢?谁知道呢 题目意思: 定义f(x) = x分解质因数出来的因子个数 如 x = p0 * p0 * p0 * p1 * p2,则f(x) = 5 特殊的, f(1) = 0 求 i = [1..n], j = [1..m] 组成的n*m组(i, j)对中,有多少组f( gcd(i,j) ) <= p 考虑简化版本,p = 0,即求有多少组 gcd(i,j) == 1. 见HDU 1695 h…
题解 http://blog.csdn.net/u010257508/article/details/11936129 #include <iostream> #include <cstdio> #include <cstring> using namespace std; const int maxn=1e4+9; int mint[maxn],maxt[maxn],ans[maxn]; int n,t,a,b; void dfs(int t,int s,int su…
题目意思: 给定n, expect, a, b 要求你构造一组array[],存放一个1..n的排列,使的下面的程序能输出YES 题目所示代码: bool less_than(x, y) { T++; return x < y; } void work(array[], l, r) { if (l >= r) return; swap(array[(l * A + r * B) / (A + B)], array[r]); int index = l; for (i = l; i < r…
2013年山东省赛F题 Mountain Subsequences先说n^2做法,从第1个,(假设当前是第i个)到第i-1个位置上哪些比第i位的小,那也就意味着a[i]可以接在它后面,f1[i]表示从第一个开始,以a[i]为结尾的不同递增序列的个数,要加上1,算上本身.正反各跑一遍,答案加一下(f1[i]-1)*(f2[i]-1)优化就是,比a[i]小的,只有a[i]-1个 #include<iostream> #include<cstdio> #include<queue&…
2013年省赛H题你不能每次都快速幂算A^x,优化就是预处理,把10^9预处理成10^5和10^4.想法真的是非常巧妙啊N=100000构造两个数组,f1[N],间隔为Af2[1e4]间隔为A^N,中间用f1来填补f[x]=f1[x%N]*f2[x/N]%P; #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #inclu…
2013年省赛I题判断单向联通,用bfs剪枝:从小到大跑,如果遇到之前跑过的点(也就是编号小于当前点的点),就o(n)传递关系. bfs #include<iostream> #include<cstdio> #include<queue> #include<algorithm> #include<cmath> #include<ctime> #include<set> #include<map> #inclu…
Walk Through Squares Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 200    Accepted Submission(s): 57 Problem Description   On the beaming day of 60th anniversary of NJUST, as a military colleg…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4816 2013长春区域赛的D题. 很简单的几何题,就是给了一条折线. 然后一个矩形窗去截取一部分,求最大面积. 现场跪在这题,最后时刻TLE到死,用的每一小段去三分,时间复杂度是O(n log n) , 感觉数据也不至于超时. 卧槽!!!!代码拷回来,今天在HDU一交,一模一样的代码AC了,加输入外挂6s多,不加也8s多,都可AC,呵呵·····(估计HDU时限放宽了!!!) 现场赛卡三分太SXBK…
Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 300    Accepted Submission(s): 135 Problem Description MMM got a big big big cake, and invited all her M friends to eat the cake toge…
Flyer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 386    Accepted Submission(s): 127 Problem Description The new semester begins! Different kinds of student societies are all trying to adver…
Caocao's Bridges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 194    Accepted Submission(s): 89 Problem Description Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But…
杭州现场赛的题.BFS+DFS #include <iostream> #include<cstdio> #include<cstring> #define inf 9999999 using namespace std; char mp[105][105]; int sq[5][5]; int step[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; struct pos { int x,y; }; int n,m,prn,x,y,tmp,ans…
Poker Shuffle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 95    Accepted Submission(s): 24 Problem Description Jason is not only an ACMer, but also a poker nerd. He is able to do a perfect s…
Divide Groups Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 423    Accepted Submission(s): 161 Problem Description   This year is the 60th anniversary of NJUST, and to make the celebration mor…
Count The Pairs Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 277    Accepted Submission(s): 150 Problem Description   With the 60th anniversary celebration of Nanjing University of Science…
Mex Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 623    Accepted Submission(s): 209 Problem Description Mex is a function on a set of integers, which is universally used for impartial game t…
Save Labman No.004 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 624    Accepted Submission(s): 154 Problem Description Due to the preeminent research conducted by Dr. Kyouma, human beings hav…
Zhuge Liang's Mines Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 239    Accepted Submission(s): 110 Problem Description In the ancient three kingdom period, Zhuge Liang was the most famous an…
题意:一个数列,给出这个数列中的某些位置的数,给出所有相邻的三个数字的和,数列头和尾处给出相邻两个数字的和.有若干次询问,每次问某一位置的数字的最大值. 分析:设数列为a1-an.首先通过相邻三个数字的和我们可以求出a3,a6,a9……是多少.a3=sum(a1,a2,a3)-sum(a1,a2).a6=sum(a4,a5,a6)-sum(a3,a4,a5).后面依次类推. 推到了数列的最右面,如果恰好知道了an或者a(n-1)中的一个,那么可以通过sum(an,a(n-1))减去它来求得另一个…
题目 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3856 先预处理求出两个素数的和与积,然后枚举n-prime和n/prime的情况. 表达式可能的情况 a a*b a+b a+b+c a*b*c a*b+c  (注意没有(a+b)*c的情况) 对于a*b和a+b的判重 只需要控制 a<=b的范围即可 对于a*b+c的情况 不存在重复情况 对于a+b+c a*b*c 分三种情况 ①a!=b && b!=c…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4793 解题报告:在一个平面上有一个圆形medal,半径为Rm,圆心为(0,0),同时有一个圆形范围圆心也是(0,0),半径为R,R > Rm,现在向平面上投掷一枚硬币,硬币初始的圆心位置为(x,y),半径是r,给出硬币的速度向量,硬币碰到medal的时候会反射,注意,反射就是原路返回,并不是按照常理的按照圆心连线的路线,表示一直以为是这样,WA了很久,然后,让你求硬币跟圆形范围有交集的时候的总时间是…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4791 解题报告:打印店提供打印纸张服务,需要收取费用,输入格式是s1 p1 s2 p2 s3 p3...表示打印区间s1到s2张纸的单价是p1,打印区间s2 到s3的单价是p2....最后是sn到无穷大的单价是pn,让你求打印k张纸的总费用最少是多少?有m次查询. 因为s1*p1 > s2 * p2 > s3*p3......,很显然,加入k所在的那个区间是第x个区间,那么最低费用要么是k * p…
Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her print service found some tricks to save money. For example, the price when…
Collision Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge There's a round medal fixed on an ideal smooth table, Fancy is trying to throw some coins and make them slip towards the medal to collide. There's also a round range which…
Alice's Print Service Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1855    Accepted Submission(s): 454 Problem Description Alice is providing print service, while the pricing doesn't seem to…
The Donkey of Gui Zhou Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 389    Accepted Submission(s): 153 Problem Description There was no donkey in the province of Gui Zhou, China. A trouble m…