题意:给出p个数字,使用+,-,*,/,这四个运算符使得最后结果等于n(四个运算符的优先级相同)
思路:回溯+剪枝,不剪枝的话会TLE。用一个标记数组记录在计算的结果。
#include
#include
#include
#include
#include
using namespace std;
const int MAXN = 32000;
const in...
分类:
其他好文 时间:
2014-08-01 23:19:12
阅读次数:
277
Brave GameTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6434Accepted Submission(s): 4294Problem ...
分类:
其他好文 时间:
2014-08-01 22:53:22
阅读次数:
194
Greedy, Greedy, Greedy.. It is all about maximum interval update.One trick is, we start looping over each element from the one nearest to end to farth...
分类:
其他好文 时间:
2014-08-01 13:32:21
阅读次数:
283
A simulation problem. We simple walk through all reachable items until we cannot proceed.class Solution {public: bool canJump(int A[], int n) { ...
分类:
其他好文 时间:
2014-08-01 13:16:01
阅读次数:
180
Problem Description
Bob is a strategy game programming specialist. In his new city building game the gaming environment is as follows: a city is built up by areas, in which there are streets, trees...
分类:
其他好文 时间:
2014-08-01 10:54:28
阅读次数:
315
One Person Game
Time Limit: 1 Second Memory Limit: 32768 KB Special Judge
There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 ha...
分类:
其他好文 时间:
2014-07-31 20:51:57
阅读次数:
311
取石子(一)/*巴什博奕(Bash Game): 只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。 最后取光者得胜。 显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个, 后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:...
分类:
其他好文 时间:
2014-07-31 09:42:55
阅读次数:
174
Description
Dumbear likes to play the Chinese Rings (Baguenaudier). It’s a game played with nine rings on a bar. The rules of this game are very simple: At first, the nine rings are all on the bar....
分类:
其他好文 时间:
2014-07-30 20:50:24
阅读次数:
319
Problem Description
Bean-eating is an interesting game, everyone owns an M*N matrix, which is filled with different qualities beans. Meantime, there is only one bean in any 1*1 grid. Now you want t...
分类:
其他好文 时间:
2014-07-30 20:46:54
阅读次数:
262
Master-Mind Hints
MasterMind is a game for two players. One of them, Designer, selects a secret code. The other,Breaker, tries to break it. A code is no more than a row of colored dots. ...
分类:
其他好文 时间:
2014-07-30 14:44:53
阅读次数:
242