
OJ
MrWrong
这个作者很懒,什么都没留下…
展开
-
HDOJ 1010 深度优先搜索 用例过了还是WA了不知道为什么
没有用剪枝,就是纯粹的dfs,不知道为什么WA了。洗洗睡了。#include #include using namespace std;#define MAX 8char map[MAX][MAX];int n,m,t;int dx,dy;int d[4][2] = {{0,1},{-1,0},{0,-1},{1,0}};bool flag=false;void dfs(int原创 2013-11-16 00:03:26 · 588 阅读 · 0 评论 -
HDOJ 2059 龟兔赛跑
Problem Description据说在很久很久以前,可怜的兔子经历了人生中最大的打击——赛跑输给乌龟后,心中郁闷,发誓要报仇雪恨,于是躲进了杭州下沙某农业园卧薪尝胆潜心修炼,终于练成了绝技,能够毫不休息得以恒定的速度(VR m/s)一直跑。兔子一直想找机会好好得教训一下乌龟,以雪前耻。最近正值HDU举办50周年校庆,社会各大名流齐聚下沙,兔子也趁此机会向乌龟发起挑战。虽然乌龟深知原创 2013-11-10 10:16:17 · 672 阅读 · 0 评论 -
HD 1058 Humber Numbers。本地都通过了最终还是WA了,莫名其妙
#include #include using namespace std;int findMin(int a,int b){ return a>=b?b:a;}int main(){ //ifstream cin("input.txt"); int dp[5844],n=1; dp[1] = 1; int a=1,b=1,c=1,d=1; for (int i = 2原创 2013-11-10 00:06:26 · 750 阅读 · 0 评论 -
HDOJ 2084 数塔问题
自底向上求解。状态转移方程是dp[i][j] = max(dp[i+1][j],dp[i+1][j+1]) + a[i][j].一开始一直WA,后来把数组最大下标值从100改成101就AC了。#include #include using namespace std;int findMax(int a , int b){ return a >= b ?a:b;}int m原创 2013-11-09 23:02:52 · 762 阅读 · 0 评论 -
HDOJ1003 简单DP问题
#include #includeusing namespace std; #define Min -999999 int main() { //ifstream cin("input.txt");int data[100000],start,end; int m; int step=1; cin>>m原创 2013-11-07 20:16:10 · 590 阅读 · 0 评论 -
HDOJ 1159 Common Subsequence
其实就是最长公共子序列的简化版。#includeint c[1000][1000];int max(int x,int y){ if(x<y) x=y; return x;}int main(){ char a[1000],b[1000]; int i,j; while(scanf("%s%s",a,b)!=-1){ for(i=0;i<=1000;i++){原创 2013-11-09 10:33:21 · 606 阅读 · 0 评论 -
HDOJ 1087 Super Jumping! Jumping! Jumping!简单DP
题目是:Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to原创 2013-11-09 01:52:20 · 446 阅读 · 0 评论 -
HD1008简单题
#include #include using namespace std;int main(){ //ifstream cin("input.txt"); int floor[100],visit[100]; memset(visit,0,sizeof(visit)); int stop=5,upSpeed=6,downSpeed=4,n=0,pre,time; while (原创 2013-11-23 15:51:06 · 651 阅读 · 0 评论 -
HD1009 经典贪心
#include #include #include #include using namespace std;#define MAX 1000struct room{ int f,j; double rate; bool operator<(room r) { return rate>r.rate; }};room rooms[MAX];int main(){原创 2013-11-23 15:22:31 · 718 阅读 · 0 评论 -
HDOJ1004 so easy
#include #includeusing namespace std; #define Min -999999 int main() { //ifstream cin("input.txt");int data[100000],start,end; int m; int step=1; cin>>m原创 2013-11-07 20:16:42 · 642 阅读 · 0 评论 -
求最长递减子序列
#include #include #include using namespace std;int main(){ifstream cin("input.txt");int n;int a[100],dp[100],max=0,index;cin>>n;for (int i = 0 ; i {cin>>a[i];}for (int i =原创 2013-11-07 21:52:42 · 711 阅读 · 0 评论 -
HDOJ1052田忌赛马
Here is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king and others.""Both o原创 2013-11-07 20:17:33 · 943 阅读 · 0 评论 -
HDOJ1160 FatMouse's Speed 弄了一晚上还是WA了,感觉有不止一个解啊
#include #include #include #include using namespace std;struct FatMouse{ int id; int next; int weight; int speed; FatMouse(int w,int s) { weight = w; speed = s; } bool operator<(FatM原创 2013-11-07 22:37:50 · 756 阅读 · 1 评论 -
母函数与排列组合
母函数与排列组合 在谈论母函数问题之前,我们先看一个简单的问题描述:假如有两组数据(A,B)和(C,D),每组中选出一个构成一个组合,总共有几种选法?很显然总共有4种选法:AC,AD,BC,BD。而且很容易联想到这个式子(A+B)*(C+D)=A*C+A*D+B*C+B*D。式子中的几个乘积项就是上面的4种选法。假如把问题换一下:每组中选出一个或0个数据构成组合,总共有几种组合?那么结果转载 2013-11-12 22:16:10 · 831 阅读 · 0 评论