
Algorithm
文章平均质量分 63
Galaxy_hao
在读研究生
展开
-
杭电 2044 一只小蜜蜂...
http://acm.hdu.edu.cn/showproblem.php?pid=2044f[1]表示相差一时的路线数#include<stdio.h>int main(){ int n,a,b,i; __int64 f[50]; scanf("%d",&n); f[1] = 1; f[2] = 2; for(i = 3;i ...原创 2014-01-25 12:08:47 · 656 阅读 · 0 评论 -
杭电 2057 A + B Again
http://acm.hdu.edu.cn/showproblem.php?pid=2057开始想偷懒只用16进制输入输出来解决,怎么也没有写出来,后来就把问题划归为进制转换问题,一步一步写了出来。#include<stdio.h>#include<string.h>__int64 fang(int i){ __int64 y = 1; int j; for(j ...原创 2014-02-07 11:08:30 · 781 阅读 · 0 评论 -
杭电 2056 Rectangles
http://acm.hdu.edu.cn/showproblem.php?pid=2056#include<stdio.h>void swap(double *x,double *y){ double t; t = *x; *x = *y; *y = t;}int main(){ double x1,x2,x3,x4,y1,y2,y3,y4,x5,y5,x6,y6...原创 2014-02-06 17:44:32 · 939 阅读 · 0 评论 -
杭电 2055 An easy problem
http://acm.hdu.edu.cn/showproblem.php?pid=2055#include<stdio.h>int main(){ int n,y; char x; scanf("%d",&n); getchar(); while(n--){ scanf("%c%d",&x,&y); getchar(); if(x &...原创 2014-02-06 16:01:17 · 815 阅读 · 0 评论 -
杭电 2054 A==B?
这道题题意说得不太清楚。。。参考了网上的一些解法,总结如下:比较简单的解法:http://blog.youkuaiyun.com/zhaorongxia/article/details/7629858c语言版:#include<stdio.h>#include<string.h>void qq(char *a){ int len,i; len=strlen(a)-1;...原创 2014-02-06 11:54:35 · 737 阅读 · 0 评论 -
杭电 2053 Switch Game
http://acm.hdu.edu.cn/showproblem.php?pid=2053#include<stdio.h>#include<string.h>int a[100001];int main(){ int n,i,j; while(scanf("%d",&n) != EOF) { memset(a,0,sizeof(a)); fo...原创 2014-02-05 15:46:15 · 753 阅读 · 0 评论 -
杭电 2052 Picture
http://acm.hdu.edu.cn/showproblem.php?pid=2052开始时把行列坐标搞错了#include<stdio.h>int main(){ int n,m,i,j; char s[75][75]; while(scanf("%d%d",&n,&m) != EOF){ for(i = 0;i <= m+1;i++) f...原创 2014-02-04 11:37:16 · 656 阅读 · 0 评论 -
杭电 2051 Bitset
http://acm.hdu.edu.cn/showproblem.php?pid=2051#include<stdio.h>int main(){ int n,a[30],i,j; while(scanf("%d",&n) == 1){ i = 0; while(n){ a[i++] = n%2; n = n/2; } for(j = i-1...原创 2014-02-04 10:51:43 · 720 阅读 · 0 评论 -
杭电 2048 神、上帝以及老天爷
http://acm.hdu.edu.cn/showproblem.php?pid=2048错排公式说明:http://baike.baidu.com/view/668994.htmN张票的所有排列可能是Ann = N!种排列方式现在的问题就是N张票的错排方式有几种。首先我们考虑,如果前面N-1个人拿的都不是自己的票,即前N-1个人满足错排,现在又来了一个人,他手里拿的是自己的票。只要他把自己的票...原创 2014-02-03 11:14:07 · 802 阅读 · 0 评论 -
杭电 2050 折线分割平面
http://acm.hdu.edu.cn/showproblem.php?pid=2050其它参考:http://blog.youkuaiyun.com/lishuhuakai/article/details/8518245#include<stdio.h>int main(){ int c,n; scanf("%d",&c); while(c--){ scanf("%d",...原创 2014-01-27 11:56:53 · 779 阅读 · 0 评论 -
杭电 2047 阿牛的EOF牛肉串
http://acm.hdu.edu.cn/showproblem.php?pid=2047#include<stdio.h>int main(){ int n,i,j; __int64 f[40]; f[1] = 3; f[2] = 8; for(i = 3;i < 40;i++){ f[i] = f[i-1]*2+f[...原创 2014-01-26 12:32:32 · 840 阅读 · 0 评论 -
杭电 2045 不容易系列之(3)—— LELE的RPG难题
http://acm.hdu.edu.cn/showproblem.php?pid=2045#include<stdio.h>int main(){ int n,i; __int64 f[51]; f[1] = 3; f[2] = 6; f[3] = 6; for(i = 4;i <= 50;i++) { ...原创 2014-01-26 10:56:29 · 740 阅读 · 0 评论 -
杭电 2018 母牛的故事
http://acm.hdu.edu.cn/showproblem.php?pid=2018 其它参考:http://hi.baidu.com/lileiyang12/item/55a6cc387dee6981f5e4ada4第n年牛总数由四部分组成,老母牛,一岁母牛,两岁母牛,三岁母牛,f[i-1] = i年老母牛+i年两岁母牛+i年三岁母牛;f[i-3] = i年一岁母牛。#include&l...原创 2014-01-25 22:40:21 · 768 阅读 · 0 评论 -
杭电 2046 骨牌铺方格
http://acm.hdu.edu.cn/showproblem.php?pid=2046#include<stdio.h>int main(){ int n,i; __int64 f[51]; f[1] = 1; f[2] = 2; for(i = 3;i <= 50;i++){ f[i] = f[i-1]+f[i-2...原创 2014-01-25 15:13:44 · 574 阅读 · 0 评论 -
杭电 2041 超级楼梯
http://acm.hdu.edu.cn/showproblem.php?pid=2041经典递推#include<stdio.h>int main(){ int n,m,y[41],i; scanf("%d",&n); y[1] = y[2] = 1; for(i = 3;i <= 40;i++) y[i] = y[...原创 2014-01-25 15:05:12 · 576 阅读 · 0 评论 -
杭电 2058 The sum problem
http://acm.hdu.edu.cn/showproblem.php?pid=2058开始时用穷举法,时间总是超时。#include<stdio.h>#include<math.h>int main(){ int n,m,i,sum; double t; while(scanf("%d%d",&n,&m) == 2 && n...原创 2014-02-07 17:07:30 · 874 阅读 · 0 评论