X-man

导航

上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 59 下一页

2013年4月26日 #

hdu 2832 (Snail’s trouble)

摘要: #include<stdio.h>#include<math.h>const double esp=1.0e-10;double a[400];int main(){ int k; int i; a[0]=0; for(i=1;i<400;i++) a[i]=a[i-1]+1.0/i; int b[11]={441,710,1230,2336,4983,12367,37568,150661, 898515,9717617,272400600}; while(scanf("%d",&k)!=EOF) //for(k=5;k<101; 阅读全文

posted @ 2013-04-26 14:43 雨钝风轻 阅读(288) 评论(0) 推荐(0) 编辑

2013年4月25日 #

hdu 1170(Balloon Comes!)

摘要: #include<stdio.h>#include<math.h>#define zero 1e-10int main(){ int _case; char ys; int a,b,c; double d; while(scanf("%d",&_case)) { while(_case--) { getchar(); scanf("%c %d %d",&ys,&a,&b); if(ys=='+')printf("%d\n",a+b); ... 阅读全文

posted @ 2013-04-25 16:00 雨钝风轻 阅读(211) 评论(0) 推荐(0) 编辑

hdu 2816(I Love You Too)(STL)

摘要: #include<stdio.h>#include<map>#include<string>#include<iostream>using namespace std;map<string,char>ms;map<char,char>mc;string s1,s2,si;int main(){ int t; ms["21"]='A'; ms["22"]='B'; ms["23"]='C'; ms["31&q 阅读全文

posted @ 2013-04-25 15:41 雨钝风轻 阅读(237) 评论(0) 推荐(0) 编辑

2013年4月24日 #

排列组合算法

摘要: 排列组合有多种实现方法,下面介绍整理的一些方法。一、最简单直接的就是递归原理比较直接:计算一个集合的组合,首先选择一个元算,然后在剩下的集合中选择剩下的元素。看下面的源代码:/***************************计算一个集合的组合*************************/#include<stdlib.h>#include<assert.h>/**************************递归:首先选择一个元素,然后在剩下的集合中选择其余元素************************/typedef struct LiStack{ 阅读全文

posted @ 2013-04-24 22:26 雨钝风轻 阅读(1147) 评论(0) 推荐(0) 编辑

排列组合问题的通用算法

摘要: 排列组合问题的通用算法分类:算法设计2006-05-25 17:2632902人阅读评论(11)收藏举报算法permutationdelete存储class生活 尽管排列组合是生活中经常遇到的问题,可在程序设计时,不深入思考或者经验不足都让人无从下手。由于排列组合问题总是先取组合再排列,并且单纯的排列问题相对简单,所以本文仅对组合问题的实现进行详细讨论。以在n个数中选取m(0<m<=n)个数为例,问题可分解为:1. 首先从n个数中选取编号最大的数,然后在剩下的n-1个数里面选取m-1个数,直到从n-(m-1)个数中选取1个数为止。2. 从n个数中选取编号次小的一个数,继续执行1步, 阅读全文

posted @ 2013-04-24 22:22 雨钝风轻 阅读(147) 评论(0) 推荐(0) 编辑

poj 1002(487-3279)STL中的map

摘要: #include<stdio.h>#include<string>#include<map>#include<algorithm>#include<iostream>using namespace std;string s;string ss;map<char ,char>mc;map<string, int>ms;map<string, int>::iterator it;int main(){ mc['A']='2'; mc['P']='7 阅读全文

posted @ 2013-04-24 22:00 雨钝风轻 阅读(174) 评论(0) 推荐(0) 编辑

hdu 1407(测试你是否和LTC水平一样高)

摘要: #include<stdio.h>int main(){ int sum; int x,y,z; while(scanf("%d",&sum)!=EOF) { for(x=1;x<100;x++) for(y=1;y<100;y++) for(z=1;z<100;z++) if(x*x+y*y+z*z==sum)goto R; R:printf("%d %d %d\n",x,y,z); } return 0;} 阅读全文

posted @ 2013-04-24 12:58 雨钝风轻 阅读(154) 评论(0) 推荐(0) 编辑

2013年4月23日 #

hdu 1860 (统计字符)(stl)

摘要: #include<iostream>#include<stdio.h>#include<string.h>#include<string>#include<map>using namespace std;char s1[6],s2[85];map<char,int>m;int main(){ while(1) { m.clear(); gets(s1); if(s1[0]=='#')return 0; gets(s2); if(s2[0]=='#')return 0; int s1l=str 阅读全文

posted @ 2013-04-23 22:36 雨钝风轻 阅读(234) 评论(0) 推荐(1) 编辑

woj 1478 - Key Logger(list)

摘要: 模拟题:http://acm.whu.edu.cn/land/problem/detail?problem_id=1478#include<stdio.h>#include<string>#include<list>#include<iostream>using namespace std;string s;string ::iterator its;list<char>l;list<char>::iterator itl;int main(){ int n; scanf("%d",&n); f 阅读全文

posted @ 2013-04-23 21:59 雨钝风轻 阅读(241) 评论(0) 推荐(0) 编辑

hdu 4502(吉哥系列故事——临时工计划)

摘要: 枚举的错误:View Code #include<stdio.h>#include<algorithm>using namespace std;struct Node{ int s;//time start int e;// end int c;//money}N[1010];bool cmp(Node a,Node b){ if(a.s<b.s)return true; else if(a.s==b.s&&a.c>b.c)return true; return false;}int main(){ int T,m,n; int max,mx 阅读全文

posted @ 2013-04-23 13:14 雨钝风轻 阅读(224) 评论(0) 推荐(0) 编辑

上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 59 下一页