山东省赛A题:Rescue The Princess】的更多相关文章

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&…
HEX SDUT 3896 17年山东省赛D题这个题是从矩形的左下角走到右上角的方案数的变形题,看来我对以前做过的题理解还不是太深,或者是忘了.对于这种题目,直接分析它的性质就完事了.从(1,1)走到(a,b)向左走的步数和向右走的步数是确定的,向下是代表向左向右各走了一步.细节:利用对称性,线性推逆元 对于每一种情况,向左下.向右下.向下的次数都是确定的,然后,对于每一种方向内部顺序不用考虑,然后排列组合就完事了对称性上又出错了,哎,自己也没找个小数据试一下,就...(a,b)和(a,a-b+…
http://acm.sdibt.edu.cn/JudgeOnline/problem.php?id=3230 Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry  the princess set out immediately. Yet,…
Description Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry  the princess set out immediately. Yet, the beast set a maze. Only if the prince find out the m…
Description In ACM/ICPC on-site contests ,3 students share 1 computer,so you can print your source code any time. Here you need to write a contest print server to handle all the requests. Input In the first line there is an integer T(T<=10),which ind…
传送门:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4115 昨天赛场上只想到了一种情况:最远点一定是在最后一次循环中产生的,且一定是第一次循环中最远点对应的那个点,因此想到的只是求出第一次循环中的终点,找到它相对于第一次循环里最远点的相对位置,然后.....WA了. 后来,大佬的点拨才发现,脑子是个好东西啊啊啊啊啊!也可以在第一次啊! 比如, n=26, k=2; RRRRRRUUUUUULLLLLLLDDDDDDD…
题目链接 题意: 给出一个无向图,类似三角形的样子,然后给出边的权值,问找一条从第一个点到最后一个点的路径,要求每一条边只能走一次,并且权值和最大,点可以重复走. 思路: 首先观察这个图可以发现,所有的点的度数都是偶数.然后由每条边只能走一次知道,这个是和欧拉路相关的,是欧拉道路,不是欧拉回路,因为题目要求是从一个点到另一个点.但是图的所有点的度数都是偶数,那么想办法让图中的第一个点和最后一个点度数变为奇数,其他点的度数都是偶数.这个就比较巧妙,去掉从第一个点到最后一个点的一条无重复点的路径,除…
Median Time Limit: 1 Second Memory Limit: 65536 KB Recall the definition of the median of elements where is odd: sort these elements and the median is the -th largest element. In this problem, the exact value of each element is not given, but relatio…
Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia…
题目传送门 /* 已知一向量为(x , y) 则将它旋转θ后的坐标为(x*cosθ- y * sinθ , y*cosθ + x * sinθ) 应用到本题,x变为(xb - xa), y变为(yb - ya)相对A点的位置,即B绕着A点旋转60度至C点 注意:计算后加回A点的坐标才是相对于原点的坐标 详细解释:http://www.tuicool.com/articles/FnEZJb */ #include <cstdio> #include <cmath> #include…