#include <iostream> #include <string> #include <stdlib.h> using namespace std; int main() { string array[30][2]; string a,b; int t=0; while( cin >> a ) { if ( a == "0" ) { break; } else { cin >> b; } array[t][0] = a…
Crashing Balloon Time Limit: 2 Seconds      Memory Limit: 65536 KB On every June 1st, the Children's Day, there will be a game named "crashing balloon" on TV.   The rule is very simple.  On the ground there are 100 labeled balloons, with the num…
#include <iostream> using namespace std; int main() { int **array = new int *[100]; for ( int i = 0; i < 100; i++ ) { array[i] = new int[2]; } int x, y; int t=0; while( cin >> x >> y ) { array[t][0] = x; array[t][1] = y; t++; } for (…
第三题:HDU 4730 We Love MOE Girls 传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4730 水题~~~ #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <cstdlib> #include <cmath> #include <vector&…
这次的答案是猜出来的,如果做得话应该是应该是一个几何概型的数学题: 答案就是:n/(m^(n-1)); 具体的证明过程: 1.首先枚举这M个点中的的两个端点,概率是:n*(n-1); 2.假设这个蛋糕是个圆盘状的,圆面面积为1,然后为了满足题目的要求,这两个端点+圆心所组成的扇形的的面积应该小于1/m: 3.然后对剩下的所有点都应该分布在这个扇形里面,加设扇形面积为x,则结果应该为:x^(n-2)在0-1/m中的积分,然后再乘以n*n-1; n,m<=20.这牵扯到大数运算,为了简单起见就用了J…
一个KMP的简单题 不过好久没用过这个东东了,今天写的时候花了很多时间: 只需要花点时间判断下所有的元素都相同的的情况就行了! #include<cstdio> #include<cstring> #include<algorithm> #define maxn 1000006 using namespace std; char s[maxn]; int next[maxn]; void getnext(char *t) { // t为模式串 ,j= -,l = str…
题目概述:Crashing Balloon On every  June 1st, the Children's Day, there will be a game named "crashing balloon" on  TV.   The rule is very simple.  On the ground there are 100 labeled balloons,  with the numbers 1 to 100. After the referee shouts &q…
Crashing Balloon Time Limit: 2 Seconds      Memory Limit: 65536 KB On every June 1st, the Children's Day, there will be a game named "crashing balloon" on TV.   The rule is very simple.  On the ground there are 100 labeled balloons, with the num…
转自:http://hi.baidu.com/ordeder/item/2a342a7fe7cb9e336dc37c89 2009年09月06日 星期日 21:55 初识ACM最早听说ACM/ICPC这项赛事是在大三上的算法课上张老师提到的,当时我们学校的组织参加这项活动才刚刚起步,我也没太在意,总觉得那是非常遥远的事,事实上当时我也从未相当如今我们能获得现在的成绩.真正踏入ACM/ICPC这个神奇的世界,不得不提到2004那一年我们学校的参赛队伍xmutank,正是听了pipo师兄的精彩演讲以…
http://acm.hdu.edu.cn/showproblem.php?pid=4712 Hamming Distance Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 1610    Accepted Submission(s): 630 Problem Description (From wikipedia) For bina…