- 博客(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
661
原创 HDU 1312 Red and Black(简单广搜)
题目呀链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 #include #include #include using 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
732
原创 hdu 1597 find the nth digit
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1597 //用C++交能过,G++交就不能过,不知道为什么 #include int main() { int T; scanf("%d",&T); while(T--) { int n,i=1; scanf("%d",&n);
2013-12-07 11:00:19
550
原创 hdu 1062 Text Reverse
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 #include #include int main() { int T; scanf("%d",&T); getchar(); while(T--) { char s[1010]; gets(s); in
2013-12-06 20:17:14
504
原创 HDU 1113 Word Amalgamation
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1113 本题目用map图做的话就很简当了 #include #include #include #include using namespace std; int main() { string s,t; map M;//建一个下标为字符串的,存东西也是字符串的M; whil
2013-12-06 11:29:58
550
原创 HDU 1978 How many ways(dfs)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1978 #include #include #include using 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
558
原创 HDU 2084 数塔(DP)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2084 #include #include #include using 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
486
原创 HDU 1251 统计难题(字典树)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1251#include #include #include #define LED struct node struct node { int n; struct node *next[26]; }; struct node *root; struct node *build() {
2013-12-03 19:20:47
484
原创 HDU 1285 确定比赛名次
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1285 #include #include #include using 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
459
原创 HDU 1247 Hat’s Words(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247 #include #include #include #include char str1[16],str2[16],map[50005][16]; using namespace std; struct node { bool flag; node *next[26];
2013-12-03 19:08:51
450
原创 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
540
原创 hdu 1215 七夕节
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1215 #include #include #include using namespace std; int prim[500010]; void Prim()//帅法求因子和 { int i,j; for(i=1;i<=250000;i++) {
2013-11-30 15:19:33
456
原创 HDU 1164 Eddy's research I
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1164 #include #include int 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
506
原创 hdu 1593 find a way to escape
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1593 //oo68先找个使自己角速度等于elnil角速度的同心圆,并且oo68与elnil在一条向上且不在远的一侧, #include #define PI 3.1415926 int main() { double r,R,v1,v2,t1,t2; while (scanf("
2013-11-29 19:00:46
450
转载 HDU 1501 Zipper
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1501 #include #include #include #define MAX 210 using 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
427
原创 HDU 1421 搬寝室
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1421 这道题与http://acm.hdu.edu.cn/showproblem.php?pid=1500一样#include #include #include using namespace std; int dp[2010][2010]; int s[2010]; int area(int x
2013-11-28 09:33:22
531
转载 hdu 1500
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1500 #include #include using 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
618
原创 HDU 1272 小希的迷宫
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1272 #include #include int 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
461
原创 HDU 1213 How Many Tables
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213 代码1: #include int 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
479
原创 hdu 1072 Nightmare
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1072 //这里不能标记路径,所以不能深搜,用深搜会成死循环 //广搜,无线搜索下去,当收到的时候,一定是个最短的距离, #include #include #include using namespace std; int map[8][8]; int n,m,sx,sy,tx,ty; int dx
2013-11-26 11:32:32
414
原创 hdu 1249 三角形
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1249 //可以画一个圆,圆里放一个内正三角形。当放入第二个时, //我们就把它转化为把已有的第一个三角形围着同心轴稍微往右转一点点(向左转一样的), //那么,第二个三角形的每一条边都会与第一个三角形的其中两条边相交, //这样就可得3*1*2+2个区域,3表示3条边, //1表示第二个三角形的每一
2013-11-25 10:51:56
384
原创 hdu 1292 "下沙野骆驼"ACM夏令营
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1292 #include int 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
541
原创 hdu 1397 Goldbach's Conjecture
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1397 #include #include int 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
551
原创 hdu 1016 Prime Ring Problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1016 #include #include #include #include using 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
667
原创 hdu 1078 FatMouse and Cheese(记忆化搜索)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1078 #include #include #include using 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
442
原创 hdu 2164 Rock, Paper, or Scissors?
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2164 #include using 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
578
原创 hdu 2163 Palindromes
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2163 #include #include using 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
749
原创 hdu 2161 Primes
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2161 #include #include using 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
563
原创 hdu 2160 母猪的故事
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2160 #include using 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
681
原创 hdu 2190 悼念512汶川大地震遇难同胞——重建希望小学
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2190 int 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
728
原创 hdu 2191 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2191 #include #include #include using 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
461
原创 hdu 2188 悼念512汶川大地震遇难同胞——选拔志愿者
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2188 #include int 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
434
原创 hdu 2186 悼念512汶川大地震遇难同胞——一定要记住我爱你(水题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2186 #include int main() { int T; scanf("%d",&T); while(T--) { int n,num1,num2,num3,num4; scanf("%d",&n); num1
2013-11-05 15:26:59
742
原创 hdu 1279 验证角谷猜想
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1279 #include int main() { int N,n,i,num; scanf("%d",&N); while(N--) { scanf("%d",&n); num=0;
2013-11-04 17:02:23
638
原创 hdu 1287 破译密码
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1287 #include int 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
555
原创 hdu 1228 A + B()
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1228 #include #include int 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
501
原创 hdu 1251 统计难题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251 #include #include #include #define LED struct node struct node { int n; struct node *next[26]; }; struct node *root; struct node *build()
2013-11-04 13:11:34
430
原创 hdu 1032 The 3n + 1 problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1032 #include int 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
515
原创 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那个篮子最轻) #include using namespace std; int m
2013-10-04 11:01:31
547
原创 hdu 2515 Yanghee 的算术
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2515 #include using 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
573
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅