Twenty-four

Description

There are 8 cards :1 1 2 2 3 3 4 4, you need to find out how many ways are there to choose 4 cards and these 4 cards can be used to play the game twenty-fourAttention, there is no difference between cards with the same number, 1 2 2 3 and 1 2 2 3 will be regarded as one solution, etc.

 

Hint: twenty-four is a game in which you are given 4 cards marked with numbers, and you may use +, -, * to connect all the four cards and make the result to be 24.

Input
No input in this problem.
Output
Output the result in one line. 
Sample Input
Sample Output
It’s what you need to output. :)
这个题目不知道要不要贴上来。。。为了水经验还是写上来吧。太坑了。

题意:有八张卡牌,任取四张通过+。-。*三种运算使结果等于24即可,问有多少种取法。任意两张相同数值卡牌视为同一种...

我最开始就直接枚举,然后一个个看能不能满足24.毕竟24=24*1=12*2=8*3=6*4。很简单能够套出答案有13种。马上输出13空行。提交。结果Wa了。为什么!!!然后我以为我理解错了,求解大神...fushihui大神马上指明一条“明路”--不能有括号?晕。反正最后答案还是出来了,是13!!!没有空行。还是太年轻了。

cout<<13<<endl;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值