2012年9月2日

hdu 2111 Saving HDU (DP)

摘要: 点击打开链接 ps:动态规划 -装箱 #include #include struct fun { int p,m; }a[105]; int cmp(const void*a,const void *b) { struct fun *c=(st... 阅读全文

posted @ 2012-09-02 09:28 Slege 阅读(86) 评论(0) 推荐(0) 编辑

hdu 2080 夹角有多大II (数学)

摘要: 点击打开链接 PS:夹角用余弦定理:c*c=b*b+a*a-2*b*a*cos(C); a=sqrt(x1*x1+y1*y1);----1 b=sqrt(x2*x2+y2*y2);----2 m=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); 由以上... 阅读全文

posted @ 2012-09-02 09:27 Slege 阅读(112) 评论(0) 推荐(0) 编辑

hdu 2602 Bone Collector (01背包)

摘要: 点击打开链接 #include #include int max(int a,int b) { return a>b?a:b; } int main() { int t,i,j,n,V,price[1001],volume[1001],v[1001]; scanf("%d",&t); ... 阅读全文

posted @ 2012-09-02 09:27 Slege 阅读(102) 评论(0) 推荐(0) 编辑

hdu 2078 复习时间 (水。。)

摘要: 点击打开链接 #include int main() { int t,n,m,i,min,a; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); min=100; for(i=0;i<n;i++) { scanf(... 阅读全文

posted @ 2012-09-02 09:26 Slege 阅读(111) 评论(0) 推荐(0) 编辑

hdu 3809 Decrypt coordinate (水。。)

摘要: 点击打开链接 PS:题目意思:让你求解方程: x1=x-sqrt(y); y1=y-sqrt(x); 已知x1,y1,要求x与y,精确到小数点后6位。 解题思路; 迭代法,式子是这样推的: x=x1+sqrt(y); y=y1+sqrt(x); 然后一开始把y=y1,x=x1赋值上去迭代,因... 阅读全文

posted @ 2012-09-02 09:26 Slege 阅读(227) 评论(0) 推荐(0) 编辑

hdu2123 An easy problem (水。)

摘要: 点击打开链接 #include int main() { int i,j,n,t; scanf("%d",&t); while(t--) { scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { ... 阅读全文

posted @ 2012-09-02 09:25 Slege 阅读(135) 评论(0) 推荐(0) 编辑

hdu 2524 矩形A + B (找规律)

摘要: 点击打开链接 PS:找规律, 有n行和m列。 如果只看一行的话,它有多少个矩形呢?单个地数有m个,两个地数有m-1个……,m个地数有1个。每一行就有:1+2+3+……+m个=(1+m)*m/2。 我们把每一行抽象成一个矩形,也就只剩一列了。一列的话,有:1+2+……+n=(1+n)*n... 阅读全文

posted @ 2012-09-02 09:25 Slege 阅读(134) 评论(0) 推荐(0) 编辑

hdu 1877 又一版 A+B (水)

摘要: 点击打开链接 PS:wrong了一次,没注意0+0的情况,本题为简单的进制转换 #include #include int main() { int a,b,m,k; char s[222]; while(scanf("%d%d%d",&m,&a,&b),... 阅读全文

posted @ 2012-09-02 09:24 Slege 阅读(113) 评论(0) 推荐(0) 编辑

hdu 1555 How many days? (模拟)

摘要: 点击打开链接 #include #include int main() { int m,k,cnt,day; while(scanf("%d%d",&m,&k)!=EOF&&m!=0||k!=0) { cnt=0;day=0; while(... 阅读全文

posted @ 2012-09-02 09:24 Slege 阅读(104) 评论(0) 推荐(0) 编辑

hdu 1161 Eddy's mistakes (strlwr与strupr的运用)

摘要: 点击打开链接 PS:string函数中的strlwr的运用,strlwr(将字符串中的字母转换为小写) strupr(转换为大写) #include #include int main() { char str[1111]; while(gets(str)) { strlwr(str... 阅读全文

posted @ 2012-09-02 09:23 Slege 阅读(170) 评论(0) 推荐(0) 编辑

hdu 3105 Fred's Lotto Tickets (水)

摘要: 点击打开链接 PS:题目意思是判断输入的数字是否将1-49全包含进去,如果说输出Yes 否则 No #include #include int main() { int i,j,n,a[111][6],aa[50]; while(scanf("%d",&n),n!=0) { fo... 阅读全文

posted @ 2012-09-02 09:22 Slege 阅读(123) 评论(0) 推荐(0) 编辑

hdu 2575 Count Problem (水)

摘要: 点击打开链接 PS:题目很简单,找到规律然后用数组储存,本体笔下误错了一次! #include #include int main() { int t,n,a[10]={0,1,2,2,4,4,6,6,10,10}; scanf("%d",&t); whi... 阅读全文

posted @ 2012-09-02 09:22 Slege 阅读(88) 评论(0) 推荐(0) 编辑

hdu 1860 统计字符 (水)

摘要: 点击打开链接 题目意思:输入两个字符串,输出第一个字符串中各个字符的个数!,注意空格也算,还有相同字符的情况下,要重复输出! #include #include #define M 88 int main() { char str[M],s[6]; int cnt[6],i,j; whi... 阅读全文

posted @ 2012-09-02 09:21 Slege 阅读(112) 评论(0) 推荐(0) 编辑

hdu3079 Vowel Counting (strlwr(将字符串中的字母转换为小写);strupr(转换为大写))

摘要: 点击打开链接 题目意思:将元音字母转换为大写,其他为小写 string:strlwr(将字符串中的字母转换为小写);strupr(转换为大写) #include #include int main() { int t,i; char str[55]; scanf("%d"... 阅读全文

posted @ 2012-09-02 09:20 Slege 阅读(156) 评论(0) 推荐(0) 编辑

hdu 3953 I'll play a trick on you (递推)

摘要: 题目很坑爹!!!规律是让两个数的个位数字相加!! #include #include int main() { int t; int i,j; char a[200],b[200]; int sum; scanf("%d\n",&t); for(i... 阅读全文

posted @ 2012-09-02 09:19 Slege 阅读(138) 评论(0) 推荐(0) 编辑

hdu 3817 Triangle (水)

摘要: 点击打开链接 题目意思:判断一个三角形是钝角还是锐角还是直角 #include int main() { int n,a,b,c,k=1; scanf("%d",&n); while(n--) { scanf("%d %d %d",&a,&b,&... 阅读全文

posted @ 2012-09-02 09:19 Slege 阅读(110) 评论(0) 推荐(0) 编辑

hdu 1248 寒冰王座 (水)

摘要: 点击打开链接 题目意思:买东西,有三种价格的商品150 200 350,商店不找零,所以多余的钱给商店,求给商店的最少的钱 暴力求解!! #include int main() { int t,a,b,c,n,i,j,k,max,temp; scanf("%d",&t); ... 阅读全文

posted @ 2012-09-02 09:18 Slege 阅读(110) 评论(0) 推荐(0) 编辑

hdu 2504 又见GCD (水)

摘要: 点击打开链接 题目意思:给你两个数a和b,找到一个最小的数c,使a和c的最大公约数为b #include int gcd(int x,int y)//求最大公约数 { while(x>y?(x%=y):(y%=x));//这里的分号不要丢了 return x+y; } int main()... 阅读全文

posted @ 2012-09-02 09:17 Slege 阅读(92) 评论(0) 推荐(0) 编辑

hdu 2560 Buildings (水)

摘要: 点击打开链接 水题!找n*m数组中,值为1的个数! #include int main() { int i,j,n,m,sum,t,a; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); sum=0; for(i=0;i<n... 阅读全文

posted @ 2012-09-02 09:16 Slege 阅读(164) 评论(0) 推荐(0) 编辑

hdu 2740 Root of the Problem (水)

摘要: 点击打开链接 题目意思很简单,给你一个b和一个n,找到一个a使a^n最接近b 先求出a=b^(1/n),然后再它附近找, #include #include void main() { float B,N,A1,A2,A3,A; scanf("%f%f",&B,&N); wh... 阅读全文

posted @ 2012-09-02 09:15 Slege 阅读(87) 评论(0) 推荐(0) 编辑

导航