zoj 1003 Crashing Balloon

来源:互联网 发布:怎么去香港买pd 1知乎 编辑:程序博客网 时间:2024/05/16 10:33

      自己的水平还是不够,这题想了好久也没有想出该怎么做,最后google了 看了一下别人的标题 dfs,这才想着怎么用dfs求解. 

代码是自己写的 ...以后还要锻炼独立思考能力:

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 "Let's go!" the two players, who each starts with a score of "1", race to crash the balloons by their feet and, at the same time, multiply their scores by the numbers written on the balloons they crash. After a minute, the little audiences are allowed to take the remaining balloons away, and each contestant reports his/her score, the product of the numbers on the balloons he/she's crashed. The unofficial winner is the player who announced the highest score.

Inevitably, though, disputes arise, and so the official winner is not determined until the disputes are resolved. The player who claims the lower score is entitled to challenge his/her opponent's score. The player with the lower score is presumed to have told the truth, because if he/she were to lie about his/her score, he/she would surely come up with a bigger better lie. The challenge is upheld if the player with the higher score has a score that cannot be achieved with balloons not crashed by the challenging player. So, if the challenge is successful, the player claiming the lower score wins.

So, for example, if one player claims 343 points and the other claims 49, then clearly the first player is lying; the only way to score 343 is by crashing balloons labeled 7 and 49, and the only way to score 49 is by crashing a balloon labeled 49. Since each of two scores requires crashing the balloon labeled 49, the one claiming 343 points is presumed to be lying.

On the other hand, if one player claims 162 points and the other claims 81, it is possible for both to be telling the truth (e.g. one crashes balloons 2, 3 and 27, while the other crashes balloon 81), so the challenge would not be upheld.

By the way, if the challenger made a mistake on calculating his/her score, then the challenge would not be upheld. For example, if one player claims 10001 points and the other claims 10003, then clearly none of them are telling the truth. In this case, the challenge would not be upheld.

Unfortunately, anyone who is willing to referee a game of crashing balloon is likely to get over-excited in the hot atmosphere that he/she could not reasonably be expected to perform the intricate calculations that refereeing requires. Hence the need for you, sober programmer, to provide a software solution.

Input

Pairs of unequal, positive numbers, with each pair on a single line, that are claimed scores from a game of crashing balloon.

Output

Numbers, one to a line, that are the winning scores, assuming that the player with the lower score always challenges the outcome.

Sample Input

343 493599 61062 36

Sample Output

4961062

 

 

题意就是把两个数 M N   分解成1 到100之间的因子相乘, 两数分解的因子不能相同  问是否能做到:

dfs求解:

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 扶桑花的叶子出斑点发黄怎么办 高二的学生成绩下降特别大怎么办 六个月大的宝宝咳嗽伴有气喘怎么办 昨天奶用力吸今天好疼怎么办 律师把医院的医药费单子丢了怎么办 母亲是个不明事理的人怎么办 华西医院的就诊卡掉了怎么办 整形医院把我脸上疤痕被大了怎么办 牙齿缝里的东西很臭怎么办 五岁宝宝牙齿有空洞斑点怎么办 给别人担保贷款被起诉了怎么办 不小心在微信里登录江西移动怎么办 住院出院后医保卡在医院怎么办 医院门诊做完检查医生下班了怎么办 退税的发票勾选为抵扣的发票怎么办 买完邮轮票后护照换了怎么办? 朝阳医院挂号过了取号时间怎么办 苹果4的id密码忘了怎么办 ipad己停用5分钟后再试怎么办 手机上大智慧日线失真怎么办 安卓手机突然地图信号弱怎么办 魔兽争霸对战模式没有金币要怎么办 常州号码被标记了商铺的名字怎么办 车提档了不接收怎么办公司能收回吗 稳岗补贴如果联系方式填错了怎么办 湖北驾照扣了50多分怎么办 南京驾照违章了50多分怎么办 有一个月没有去国税保税怎么办? 刑政复议通知书被邮政延误了怎么办 高考听力报名注册了两个用户怎么办 左腿神经损伤夏天脚冰凉怎么办 给区组织部的介绍信给到社区怎么办 被丈夫和儿子强送精神病院怎么办 练车穿短袖晒的胳膊特别黑怎么办 车子卖了对方迟迟不过户怎么办 成都华西医院就诊卡密码忘了怎么办 资阳办健康证怎么办要预约吗 头发出油厉害怎么办民间小偏方 你帮助别人别人却想着害你怎么办 怀孕接触有辐射的东西回怎么办 苹果手机用久了有点卡怎么办