题目:
    链接:点击打开链接
题意:
    roy抢银行,知道每个银行的存款和被抓的概率,以及Roy能够被抓的概率,求他能够抢劫的最多的money。
思路:
    dp[i]表示抢劫i块钱不被抓的概率,当i==0时,一定不会被抓,即dp[0] = 1;
代码:
#include
#include
#include
using namespace std;
#define M...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 23:05:08   
                                阅读次数:
266
                             
                         
                    
                        
                            
                            
                                http://acm.hdu.edu.cn/showproblem.php?pid=4811
推理一下,发现可以先求出后面放小球可以加分的最大值,然后前面的和为0 + 1 + 2 + ...+ max,max最大为6,因为每个球最多算左右两边
代码:
#include 
#include 
using namespace std;
long long a, b, c;
long long ...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 23:04:28   
                                阅读次数:
387
                             
                         
                    
                        
                            
                            
                                裸题,瞬秒。。
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define L(id) tree[id].ch[0]
#define R(id) tree[id].ch[1]
#define Size(id) tree[id].size
#...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 22:52:51   
                                阅读次数:
328
                             
                         
                    
                        
                            
                            
                                题目;
    点击打开链接
代码;
#include
#include
#include
using namespace std;
struct beibao{
    int val;
    int vol;
}bag[1010];
int main()
{
    int dp[1010];
    int i,j,n,v;
    int t;
    cin>>t;
    wh...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 22:50:51   
                                阅读次数:
394
                             
                         
                    
                        
                            
                            
                                巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规
定每次至少取一个,最多取m个。最后取光者得胜。
    显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,
后取者都能够一次拿走剩余的物品,后者取胜。因此我们发现了如何取胜的法则:如果
n=(m+1)r+s,(r为任意自然数,s≤m),那么先取者要拿走s个物品,如果后取者拿走
k...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 22:50:18   
                                阅读次数:
389
                             
                         
                    
                        
                            
                            
                                Problem Description
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。
这让很多学生很反感。
不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。
 
Input
本题目包含多组测试,请处理到文件结束。
在每个测试的第一行,有两个正整数 N...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 20:23:07   
                                阅读次数:
287
                             
                         
                    
                        
                            
                            
                                题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1850
Being a Good Boy in Spring Festival
Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(...
                            
                            
                                分类:
编程语言   时间:
2014-05-15 20:04:04   
                                阅读次数:
449
                             
                         
                    
                        
                            
                            
                                Problem Description
At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcement...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 19:48:31   
                                阅读次数:
348
                             
                         
                    
                        
                            
                            
                                Problem Description
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 18:36:59   
                                阅读次数:
208
                             
                         
                    
                        
                            
                            
                                题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1847
题目意思:
有n张牌,两个人轮流抓,每次可以抓2的幂次数量的牌,求谁会赢。
n
解题思路:
sg函数简单应用。
将2的幂次表打出来。然后递推求出每个状态的sg函数,最后判断sg[n]是否为0,为0表示必输状态,否则为赢状态。
代码:
//#include
#includ...
                            
                            
                                分类:
其他好文   时间:
2014-05-15 18:23:40   
                                阅读次数:
315