UVa1073 Glenbow Museum】的更多相关文章

可以把R看成顺时针转90°,O看成逆时针转270° 设R有x个,则180*(n-2)=90*x+270*(n-x) 解得R有(n+4)/2个 O有(n-4)/2个 所以n<4或者n是奇数时无解. 确定有解时,可以DP解决. 设f[第i位][R比O多j个(j的范围为-1到5)][首位是不是O][末尾是不是O]=方案数 /*by SilverN*/ #include<iostream> #include<algorithm> #include<cstring> #in…
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2124 这道题可以用递推做,但是没有必要 首先说长度为L 假设R的个数为x,O的个数为y,那么x+y=L而且x-y=4 当L为奇数和小于4的时候肯定不可以 由于O不能相邻 可以假设O 的数目和R一样多,交叉排放.然后从这些O中 去掉4个 1,R开头的情况 C(x,4) 2,O开…
题意: 这种所有边都是垂直或水平的多边形,可以用一个字符串来表示,一个270°的内角记作O,一个90°的内角记作R. 如果多边形内存在一个点,能看到该多边形所有的点,则这个多边形对应的序列是合法的.这里长度不作限制,只要长度适当能满足要求即可. 现给出序列长度,问有多少种序列符合要求. 分析: 书上分析地很清楚,罗列一下要点: 首先对于一个长度为n的合法序列,R的个数为(n+4)/2,O的个数为(n-4)/2,即R比O多4个 我们要找的序列满足要求:R比O多4个,没有两个O相邻. 这里先设计了一…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 易得,当n为奇数或者n<3时,答案为0,否则该序列中必定有(n+4)/2个R,(n-4)/2个O: 要使该序列的排列能成立,则只需要保证(在首尾相连之后)该序列中依旧不存在相连的两个O即可: 从而可以得出当n为大于等于4的偶数时,答案等于C(n/2+1,3)+2*C(n/2+1,4); 当然,大白书还有介绍dp的方法. #include <iostream> using…
Sackler Museum of Art and Archaeology at Peking University is located on a beautiful site near the West Gate of Peking University campus, and its architecture takes the inspiration from buildings that already exist on campus. The collection of Chines…
D. Igor In the Museum Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/D Description Igor is in the museum and he wants to see as many pictures as possible. Museum can be represented as a rectangular field of n ×…
D. Igor In the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Igor is in the museum and he wants to see as many pictures as possible. Museum can be represented as a rectangular fiel…
A. Night at the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night…
D. Museum time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output One day as Petya and his friend Vasya were having one of their numerous trips, they decided to visit a museum castle. The muse…
A. Night at the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night…