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-four. Attention, 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.
题意:有八张卡牌,任取四张通过+。-。*三种运算使结果等于24即可,问有多少种取法。任意两张相同数值卡牌视为同一种...
我最开始就直接枚举,然后一个个看能不能满足24.毕竟24=24*1=12*2=8*3=6*4。很简单能够套出答案有13种。马上输出13空行。提交。结果Wa了。为什么!!!然后我以为我理解错了,求解大神...fushihui大神马上指明一条“明路”--不能有括号?晕。反正最后答案还是出来了,是13!!!没有空行。还是太年轻了。
cout<<13<<endl;