直接枚举计算就行;#include#include#include#define maxn 22using namespace std;double ans[maxn],p[maxn];bool vis[maxn];int n,r;void dfs(int cur,int cot){ if(c...
分类:
其他好文 时间:
2014-07-19 15:37:13
阅读次数:
158
题目:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=25&problem=2288&mosmsg=Submission+received+...
分类:
其他好文 时间:
2014-07-19 15:09:20
阅读次数:
313
Your little brother has just learnt to write one, two and three, in English. He has written a lot of those words in a paper, your task is to recognize...
分类:
其他好文 时间:
2014-07-19 09:31:41
阅读次数:
238
题意:有一个迷宫,迷宫中有许多火堆,Joe每次只走一步,火也是一次向四个方向蔓延一步,Joe不可以遇到火和障碍物,问Joe能否走出迷宫(只要到达边界居、就可以了)。思路:先计算每个点最先什么时候起火,再判断Joe到达这个点时是否已经起火了,这样就可以。代码:// http://uva.onlinej...
分类:
其他好文 时间:
2014-07-19 09:29:05
阅读次数:
247
UVA 10601 - Cubes
题目链接
题意:给定正方体12条棱的颜色,要求用这些棱能组成多少不同的正方体
思路:利用ploya定理去求解,分类讨论,正方体一共24种旋转,对应的旋转方式有4种:
1、不动
2、沿两面中点连线旋转
3、沿对顶点连线旋转
4、沿两棱中点连线旋转
简单推算出每种情况对应的循环组数,在加上组合数学去进行选择颜色求解,注意第4种情况中,...
分类:
其他好文 时间:
2014-07-19 08:22:12
阅读次数:
235
UVA 1156 - Pixel Shuffle
题目链接
题意:根据题目中的变换方式,给定一串变换方式,问需要执行几次才能回复原图像
思路:这题恶心的一比,先模拟求出一次变换后的对应的矩阵,然后对该矩阵求出所有循环长度,所有循环长度的公倍数就是答案
代码:
#include
#include
const int N = 1100;
int t, n, g[N]...
分类:
其他好文 时间:
2014-07-19 08:15:10
阅读次数:
307
Description
Problem E
Eat or not to Eat?
Input: Standard Input
Output: Standard Output
A young farmer has N cows, but they produced really really a very very small amount of milk. John ca...
分类:
其他好文 时间:
2014-07-19 08:09:15
阅读次数:
296
Marbles
Input: standard input
Output: standard output
I have some (say, n) marbles (small glass balls) and I am going to buy some boxes to store them. The boxes are of two types:
Type 1: each ...
分类:
其他好文 时间:
2014-07-19 08:01:10
阅读次数:
264
题目如下:
Firetruck
The Center City fire department collaborates with the transportation department to maintain maps of the city which reflects the current status of the city street...
分类:
其他好文 时间:
2014-07-19 02:47:26
阅读次数:
193
题解:题目要在b进制下输出的是一个数字阶乘后有多少个零,然后输出一共有多少位。首先计算位数,log(n)/log(b) + 1就是n在b进制下有多少位,而log有个公式就是log(M×N) = logM + logN,n! 的位数用公式可以化为( log(1) + log(2) +...+log(n) ) / log(b) + 1,为了精确再加 10^-6。阶乘后的零的数量计算是根据进制数的最大质...
分类:
其他好文 时间:
2014-07-19 02:15:36
阅读次数:
213