摘要: //大整数的加法,花了我两个小时,一定要小心仔细才行呀;//笨(本)人代码如下#include<stdio.h>#include<string.h>int fib[510][120];//the first element is the array lengthint a[120],b[120];void change(int *x)//right{ int i,temp,len; len=x[0]; for(i=1;i<=len/2;i++) { temp=x[i];x[i]=x[len+1-i];x[len+1-i]=temp; }}void countfib 阅读全文
posted @ 2011-05-27 21:15 tonyspace 阅读(460) 评论(0) 推荐(0) 编辑
摘要: 钱币兑换问题//只需要计算出可以换多少3分的和多少2分的就可以了#include <stdio.h>int main (){ int n,s,i; while (scanf("%d",&n)!=EOF) { s=n/3+1;//计算3分的 for (i=0;i<=n/3;i++) s+=(n-3*i)/2;//计算2分的 不过因为已经算过3分的 所以那一部分要先减掉 printf ("%d\n",s); } return 0;}Problem Description hdu1284在一个国家仅有1分,2分,3分硬币,将钱N兑换成 阅读全文
posted @ 2011-05-27 21:08 tonyspace 阅读(299) 评论(0) 推荐(0) 编辑