题意:输入a, b表示两堆石头数目,威佐夫博弈,问:先手胜负? a, b <= 1e100. 高精度.当a > b时, a = (a-b)*黄金分割比 时是先手败状态.因为a, b <= 1e100,所以黄金分割比至少要保留小数点后100位. BigDecimal没有开方操作,所以二分算出黄金分割比. import java.util.*; import java.io.BufferedInputStream; import java.math.*; public class Main
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5973 Game of Taking Stones Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others) 问题描述 Two people face two piles of stones and make a game. They take turns to take stones. As ga
取(2堆)石子游戏 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1730 Accepted Submission(s): 1049 Problem Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相