欢迎访问我的个人网站==》 jiashubing.cn
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4768题目大意:每组数据有n行输入,每行有三个数A、B、C,A 2 # include 3 # include 4 # define LL __int64 5 # define maxn 20010 6 using namespace std; 7 8 LL a[maxn],b[maxn],c[maxn]; 9 int n;10 11 int judge(LL l,LL r)12 {13 LL ret=0;14 for(int i=1; ib[i] || r=tmp &&(tmp-. 阅读全文
posted @ 2013-09-30 08:54 贾树丙 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋糕上的概率Sample Input23 33 4Sample Output1/34/27分析:计算出这个概率公式为:n/(mn-1),m、n最大为20,mn超出了64位,用到大数,用java容易写出代码如下: 1 import java.math.BigInteger; 2 import java.util.Scanner; 3 4 public class Main { 5 public... 阅读全文
posted @ 2013-09-30 08:18 贾树丙 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4763题目大意:给定一串字符,从中找出符合“EAEBE”格式的E的最大字符数。AB可以是任意数量的任意字符(a-z)。Sample Input5xyabcaaaaaaabaaaxoaaaaaSample Output00112分析:首先枚举判断开始和结尾是否满足作为E,再KMP计算中间是否存在E代码如下: 1 #include 2 #include 3 #include 4 using namespace std; 5 #define N 1000001 6 int next[N]; 7 char 阅读全文
posted @ 2013-09-30 08:10 贾树丙 阅读(819) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764题目大意:Tang和Jiang玩石子游戏,给定n个石子,每次取[1,k]个石子,最先取完的人失败,Tang先取,求博弈。Sample Input1 130 310 20 0Sample OutputJiangTangJiang分析:可以看成是谁先取完n-1个石子,谁获胜,则变成完完全全的巴什博弈,当然要考虑特殊情况。代码如下: 1 #include 2 # include 3 using namespace std; 4 int main() 5 { 6 int n,m; 7 8 ... 阅读全文
posted @ 2013-09-30 08:00 贾树丙 阅读(276) 评论(0) 推荐(0) 编辑