- 博客(81)
- 资源 (1)
- 收藏
- 关注
转载 FineUIt配置
Language="zh_CN" AjaxTimeout="120" EnableAjax="true" Theme="Neptune" FormMessageTarget="Qtip" FormOffsetRight="0" FormLabelWidth="100" FormLabelSeparat
2014-10-12 18:38:51
557
原创 HDU 1312 Red and Black(简单广搜)
题目呀链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312#include#include#includeusing namespace std;char map[22][22];int W,H;int dx[]={0,1,0,-1};int dy[]={1,0,-1,0};int bfs(int x,int y){ qu
2013-12-07 21:15:20
663
原创 hdu 1597 find the nth digit
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1597//用C++交能过,G++交就不能过,不知道为什么#includeint main(){ int T; scanf("%d",&T); while(T--) { int n,i=1; scanf("%d",&n);
2013-12-07 11:00:19
488
原创 hdu 1062 Text Reverse
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1062#include#includeint main(){ int T; scanf("%d",&T); getchar(); while(T--) { char s[1010]; gets(s); in
2013-12-06 20:17:14
449
原创 HDU 1113 Word Amalgamation
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1113本题目用map图做的话就很简当了#include#include#include#includeusing namespace std;int main(){ string s,t; map M;//建一个下标为字符串的,存东西也是字符串的M; whil
2013-12-06 11:29:58
482
原创 HDU 1978 How many ways(dfs)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1978#include#include#includeusing namespace std;int num[105][105],dp[105][105],n,m;int judge(int x,int y){ if(x>=1&&y>=1&&x<=n&&y<=m) return
2013-12-05 19:59:29
500
原创 HDU 2084 数塔(DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2084#include#include#includeusing namespace std;int map[102][102];int main(){ int i,j,N; int T; scanf("%d",&T); while(T--) {
2013-12-05 16:27:20
427
原创 HDU 1251 统计难题(字典树)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1251#include#include#include#define LED struct nodestruct node{ int n; struct node *next[26];};struct node *root;struct node *build(){
2013-12-03 19:20:47
416
原创 HDU 1285 确定比赛名次
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1285#include#include#includeusing namespace std;int main(){ int in[505],map[505][505],len[505],N,M,x,y,min,i,count; while(cin>>N>>M) {
2013-12-03 19:12:44
416
原创 HDU 1247 Hat’s Words(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247#include#include#include#includechar str1[16],str2[16],map[50005][16];using namespace std;struct node{ bool flag; node *next[26];
2013-12-03 19:08:51
400
原创 hdu 1286 找新朋友(欧拉函数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1286//欧拉函数:设m是衣蛾正整数,则0-(m-1)之间与m互素的整数的个数//m=p1^a1*p1^a2~~pi^ai~~pk^pk;//p1~~pk都为素数,则欧拉函数φ(m)=m*(1-1/p1)*(1-1/p2)~(1-1/pi)~(1-1/pk) [相乘]#include#i
2013-11-30 19:52:20
486
原创 hdu 1215 七夕节
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1215#include#include#includeusing namespace std;int prim[500010];void Prim()//帅法求因子和{ int i,j; for(i=1;i<=250000;i++) {
2013-11-30 15:19:33
423
原创 HDU 1164 Eddy's research I
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1164#include#includeint prim[66000];void check(){ int i,j,p=1; for(i=2;i<=32770;i++) { for(j=2*i;j<=65540;j+=i) {
2013-11-30 10:46:29
453
原创 hdu 1593 find a way to escape
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1593//oo68先找个使自己角速度等于elnil角速度的同心圆,并且oo68与elnil在一条向上且不在远的一侧,#include#define PI 3.1415926int main(){ double r,R,v1,v2,t1,t2; while (scanf("
2013-11-29 19:00:46
398
转载 HDU 1501 Zipper
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1501#include#include#include#define MAX 210using namespace std;char a[MAX], b[MAX], c[2*MAX];int dp[MAX][MAX];int main(){ int i,j,t=1,Case,
2013-11-28 21:25:21
378
原创 HDU 1421 搬寝室
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1421这道题与http://acm.hdu.edu.cn/showproblem.php?pid=1500一样#include#include#includeusing namespace std;int dp[2010][2010];int s[2010];int area(int x
2013-11-28 09:33:22
484
转载 hdu 1500
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1500#include#includeusing namespace std;int dp[5001][1001],s[5005];int area(int t){return t*t;}int main(){ int i,j,Case,k,n; scanf("%d"
2013-11-27 21:30:40
554
原创 HDU 1272 小希的迷宫
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1272#include#includeint p[100005],flag,sign[100005];//数组开在主函数里,这个代码就超时了int find(int x){return p[x]==x?x:p[x]=find(p[x]);}void father (int x,int y)
2013-11-27 15:15:20
411
原创 HDU 1213 How Many Tables
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213代码1:#includeint n,m,p[1005];int find(int x) {return p[x]==x?x:find(p[x]);}int father (int x,int y){ int xx=find(x);int yy=find(y);
2013-11-27 08:57:07
438
原创 hdu 1072 Nightmare
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1072//这里不能标记路径,所以不能深搜,用深搜会成死循环//广搜,无线搜索下去,当收到的时候,一定是个最短的距离,#include#include#includeusing namespace std;int map[8][8];int n,m,sx,sy,tx,ty;int dx
2013-11-26 11:32:32
361
原创 hdu 1249 三角形
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1249//可以画一个圆,圆里放一个内正三角形。当放入第二个时,//我们就把它转化为把已有的第一个三角形围着同心轴稍微往右转一点点(向左转一样的),//那么,第二个三角形的每一条边都会与第一个三角形的其中两条边相交,//这样就可得3*1*2+2个区域,3表示3条边,//1表示第二个三角形的每一
2013-11-25 10:51:56
342
原创 hdu 1292 "下沙野骆驼"ACM夏令营
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1292#includeint main() { int t,n,i,j; __int64 a[26][26]; a[1][1]=1; a[1][0]=0; for (i=2;i<=25;i++)//i代表现在总共几个人分组 { a
2013-11-22 21:53:35
507
原创 hdu 1397 Goldbach's Conjecture
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1397#include#includeint vis[32800];int check1(int n){ int i; for(i=2;i*i<=n;i++) { if(n%i==0) return 0; } retur
2013-11-22 15:33:41
516
原创 hdu 1016 Prime Ring Problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1016#include#include#include#includeusing namespace std;int dp[30],vis[100],N;int check(int x){ for(int i=2;i<x;i++) if(x%i==0) ret
2013-11-20 09:18:06
614
原创 hdu 1078 FatMouse and Cheese(记忆化搜索)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1078#include#include#includeusing namespace std;int dp[110][110],s[110][110];int n,k;int dx[4]={0,-1,0,1};int dy[4]={1,0,-1,0};int dfs(int x,in
2013-11-17 20:37:07
406
原创 hdu 2164 Rock, Paper, or Scissors?
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2164#includeusing namespace std;int judge(int n){ int player1=0,player2=0,i; char P,PP; for(i=0;i<n;i++) { cin>>P>>PP;
2013-11-08 15:16:23
529
原创 hdu 2163 Palindromes
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2163#include#includeusing namespace std;int judge(char *s){ int i,len=strlen(s),flag=1,j; for(i=0,j=len-1;i<=j;i++,j--) { if(
2013-11-08 14:47:40
697
原创 hdu 2161 Primes
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2161#include#includeusing namespace std;int fun(int n){ int i,flag=1; for(i=2;i<=sqrt(n);i++) { if(n%i==0) flag=0; if
2013-11-08 14:01:25
509
原创 hdu 2160 母猪的故事
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2160#includeusing namespace std;int Pig( int n ){ if ( n == 1 ) return 1 ; else if( n == 2 ) return 2; else re
2013-11-08 13:37:45
623
原创 hdu 2190 悼念512汶川大地震遇难同胞——重建希望小学
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2190int main(){ int T,dp[35],i; dp[1]=1;dp[2]=3; for(i=3;i<=30;i++) dp[i]=dp[i-1]+dp[i-2]*2; //dp[i-1]就是多1米全部放长为1米的方块
2013-11-07 13:09:16
676
原创 hdu 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2191#include#include#includeusing namespace std;int dp[102],W;int p[102],w[102],num[102];void pack(int cost,int weight){ for(int i=W;i>
2013-11-06 09:25:44
428
原创 hdu 2188 悼念512汶川大地震遇难同胞——选拔志愿者
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2188#includeint main(){ int T; scanf("%d",&T); while(T--) { int n,m; scanf("%d%d",&n,&m); if(n%(m+1)) prin
2013-11-05 17:06:09
403
原创 hdu 2186 悼念512汶川大地震遇难同胞——一定要记住我爱你(水题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2186#includeint main(){ int T; scanf("%d",&T); while(T--) { int n,num1,num2,num3,num4; scanf("%d",&n); num1
2013-11-05 15:26:59
684
原创 hdu 1279 验证角谷猜想
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1279#includeint main(){ int N,n,i,num; scanf("%d",&N); while(N--) { scanf("%d",&n); num=0;
2013-11-04 17:02:23
591
原创 hdu 1287 破译密码
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1287#includeint main(){ int i,j,a[1002],N; char s; while(scanf("%d",&N)!=EOF) { for(i=0;i<N;i++) scanf("%d",&a[i]);
2013-11-04 16:42:43
518
原创 hdu 1228 A + B()
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1228 #include#includeint main(){ char a[30]; while(1) { gets(a); int i,j,len=strlen(a),A=0,B=0; for(i=0;i<le
2013-11-04 16:11:38
463
原创 hdu 1251 统计难题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251#include#include#include#define LED struct nodestruct node{ int n; struct node *next[26];};struct node *root;struct node *build()
2013-11-04 13:11:34
401
原创 hdu 1032 The 3n + 1 problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1032#includeint main(){ int max=-1,nn,N,M,n,m,i,j,count; while(~scanf("%d%d",&N,&M)) { n=N,m=M; if(n>m){i=n;n=m;m=i;}
2013-11-04 13:08:51
478
原创 hdu 2401 Baskets of Gold Coins
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2401题目意思:总共n个篮子,从前n-1个篮子中分别抽取1个,2个...........;其中n-1个篮子的金币重量为w,有一个金币重量为d;不会从第那个篮子抽取;问是哪个篮子的重量最轻(从题意的,是金币重量为d那个篮子最轻)#includeusing namespace std;int m
2013-10-04 11:01:31
509
原创 hdu 2515 Yanghee 的算术
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2515#includeusing namespace std;int main(){ int n,num[1260],num1,t,i; while(cin>>n) { t=n*(n-1)/2; for(i=0;i>num[i];
2013-10-03 08:34:59
529
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人