摘要: Problem 1515 Balloons in a Box Accept: 137Submit: 741Time Limit: 1000 mSecMemory Limit : 32768 KBProblem DescriptionYou must write a program that simulates placing spherical balloons into a rectangular box.The simulation scenario is as follows. Imagine that you are given a rectangular box and a set 阅读全文
posted @ 2011-06-01 20:51 tonyspace 阅读(959) 评论(0) 推荐(0) 编辑
摘要: //大整数的加法,花了我两个小时,一定要小心仔细才行呀;//笨(本)人代码如下#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) 编辑
摘要: 题意:Number SequenceProblem Description hdu1005A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).InputThe input consists of multiple test cases. Each test case contains 3 integers A, B and n 阅读全文
posted @ 2011-05-21 10:56 tonyspace 阅读(276) 评论(0) 推荐(1) 编辑