2013年4月5日

hdu 2201 (简单数学概率)

摘要: 点击打开链接 /* 因为是随机事件,每个人做到自己的位置都是1/n,一开始还没想到这点,晕了不是,这么想的:前m-1人都没坐在第m人的位子的概率为P=(n-1)/n * (n-2)/(n-1)/ * .... * (n-m+1)/(n-m) ,而第m个人恰好坐在自己位子上的概率为P*1/(n-m... 阅读全文

posted @ 2013-04-05 13:43 Slege 阅读(107) 评论(0) 推荐(0) 编辑

hdu 2212 (简单数学)

摘要: 点击打开链接 有点坑。0的阶乘=0 #include"stdio.h"int main(){ printf("1\n"); printf("2\n"); printf("145\n"); printf("40585\n"); return 0;} 阅读全文

posted @ 2013-04-05 13:23 Slege 阅读(112) 评论(0) 推荐(0) 编辑

hdu 2401 (简单数学)

摘要: 点击打开链接 有n个篮子,每个篮子都有硬币,每个硬币W重,从1到n-1个篮子中一次取1-n-1个硬币,最后一个篮子不去; 如果篮子都一样,应该重ans=n*(n-1)/2;实际为p; 则差p-ans;所以可得篮子的标号; 注意相等的情况;; #include"stdio.h"#include"s... 阅读全文

posted @ 2013-04-05 13:06 Slege 阅读(127) 评论(0) 推荐(0) 编辑

hdu 2537(水)

摘要: 点击打开链接 水过... #include"stdio.h"#include"string.h"int main(){ char c; int n,a,b; //a--红;b--黄 while(scanf("%d",&n)!=-1&&n) { a=b=0; getchar(); w... 阅读全文

posted @ 2013-04-05 12:39 Slege 阅读(96) 评论(0) 推荐(0) 编辑

hdu 2552 (这题很强大)

摘要: 点击打开链接 自己不要被题目的公式吓住,那根本用不到。。。 这里用到了两个高中学的公式: 1.tan(a+b) = ( tan(a) + tan(b) ) / (1 – tan(a) * tan(b) ) 2.tan( atan(x) ) = x arctan(1/s) = arcta... 阅读全文

posted @ 2013-04-05 12:23 Slege 阅读(143) 评论(0) 推荐(0) 编辑

hdu 1181 (搜索BFS,深搜DFS,并查集)

摘要: 点击打开链接 刚开始RE了好几次; #include"stdio.h"#include"string.h"#include"queue"using namespace std;int f;int mark[26];int map[26][26];void bfs(int a){ ... 阅读全文

posted @ 2013-04-05 12:12 Slege 阅读(116) 评论(0) 推荐(0) 编辑

hdu 2710 (基础)

摘要: 点击打开链接 素数!! #include"stdio.h"#include"string.h"#include"math.h"int prime[20001];int ans[20010];void fun(){ memset(prime,-1,sizeof(prime)); ... 阅读全文

posted @ 2013-04-05 12:11 Slege 阅读(138) 评论(0) 推荐(0) 编辑

hdu 2570 (贪心)

摘要: 点击打开链接 注意浓度的算法 #include"stdio.h"#include"algorithm"using namespace std;int main(){ int t; int i; int n,v; int w,p[101]; scanf("%d",&t); while(t-... 阅读全文

posted @ 2013-04-05 10:05 Slege 阅读(113) 评论(0) 推荐(0) 编辑

hdu 2124 (赤裸裸的贪心)

摘要: 点击打开链接 有点坑,得用64位 #include"stdio.h"#include"algorithm"using namespace std;__int64 cmp(__int64 a,__int64 b){ if(a=L)break; } if(n==i)printf("impos... 阅读全文

posted @ 2013-04-05 09:41 Slege 阅读(133) 评论(0) 推荐(0) 编辑

导航