上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1015题目输入多组数据第组包括:一个整数n和一个字符串,要求从字符串中,选五个字串且满足v - w^2 + x^3 - y^4 + z^5 = n;c++#include <stdio.h>#include<string.h>#include<math.h>#include <iostream>#include <deque>using namespace std;double n,q[28],ans;char p[15];int num,len;b 阅读全文
posted @ 2011-03-23 22:12 CoderZhuang 阅读(205) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3752#include<stdio.h>#include<stdlib.h>main(){ int t,m,n; scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); if(m%2==1||n>m/2) printf("NO\n"); else printf("YES\n"); } // system("pause&quo 阅读全文
posted @ 2011-03-23 21:59 CoderZhuang 阅读(126) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3750#include<stdio.h>#include<stdlib.h>main(){ double i,j,ans,n,num; while(scanf("%lf",&n)!=EOF) { j=1;i=1;ans=0;num=1; while(num<=n) { ans=ans+i*j*1.0/n; i++; j=j*2; num=num+j; //j=j*2; } if(num>n) ans=ans+i*(j-num+n)*1.0/n; 阅读全文
posted @ 2011-03-23 21:57 CoderZhuang 阅读(123) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3747 #include #include#includeusing namespace std;main(){ int n,min,ans[4],i; char p[55],q[55]; while(scanf("%d",&n)!=EOF) { for(i... 阅读全文
posted @ 2011-03-23 21:55 CoderZhuang 阅读(113) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3744#include<stdio.h>#include<stdlib.h>main(){ long i,j,flag,t,m,n; scanf("%ld",&t); struct stud { long a,b; }p[300]; while(t--) { scanf("%ld%ld",&n,&m); for(i=1;i<=n;i++) scanf("%ld%ld",&p[i].a,&a 阅读全文
posted @ 2011-03-23 21:52 CoderZhuang 阅读(182) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1239题意:a.给定整数m,a,b(4 < m <= 100000 and 1 <= a <= b <= 1000)b.需要找到两个数(不妨设为p,q)满足以下条件: l p,q均为质数; l p*q<=m; l a/b <= p/q <= 1; c.输出所有满足以上条件的p,q中乘积最大的一对p,q 分析:考虑大于10000的某个质数,不妨设为Q,另一个质数为P,则:l如果P<10,P/Q<0.001 l如果P>10,P*Q>10000 阅读全文
posted @ 2011-03-22 22:38 CoderZhuang 阅读(139) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1372给定棋盘上的两个点,求马从起点走到终点所需的最小步数,马的走法如下(和象棋差不多),本题也是简单的BFS搜索。#include <stdio.h>#include <iostream>#include <queue>using namespace std;int xf,yf,xt,yt,ans;int dir[8][2]={{-2,1},{2,1},{-2,-1},{2,-1},{-1,2},{1,2},{-1,-2},{1,-2}};bool visited[9][ 阅读全文
posted @ 2011-03-22 20:26 CoderZhuang 阅读(116) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1312二维图:.:黑砖#:红砖@:起点求由起点最多能找到多少个黑砖,当然红砖是不能走的(上下左右四个方向);基础的搜索题,深搜或广搜都可。深搜:#include <stdio.h>#include <iostream>using namespace std;char map[21][21];int co,ro,ans;int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}};bool judge(int x,int y){ if(x<0||y<0| 阅读全文
posted @ 2011-03-22 18:40 CoderZhuang 阅读(88) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1072二维图:0:墙1:路2:起点3:终点4:可重设炸弹定时器的地方,时间又重设为6。要在6个单位时间内从起点走到终点,不过当走到“ 4”时时间又可设为6;输出可行的最短步数。#include<stdio.h>#include<stdlib.h>#include<queue>#include<string.h>#include <iostream>using namespace std;int map[10][10],tim[10][10];int 阅读全文
posted @ 2011-03-22 16:57 CoderZhuang 阅读(128) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1242一个二维表:.:路#:障碍a:要救的人r:去找的人(有多个)x:门卫找人中若遇到门卫要多花一个单位的时间本题可以反过来做,用a去找最近的r; 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<queue> 4 #include<string.h> 5 #include <iostream> 6 using namespace std; 7 char map[201][201]; 8 int 阅读全文
posted @ 2011-03-22 12:18 CoderZhuang 阅读(183) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 下一页