上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: 超级台阶时间限制:1000 ms | 内存限制:65535 KB难度:3描述有一楼梯共m级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第m级,共有多少走法?注:规定从一级到一级有0种走法。输入输入数据首先包含一个整数n(1int fun(int d,int a,int b){ int c; c=a+b; a=b; b=c; d-=1; if(d==0) return c; else if(d>0) c=fun(d,a,b); }int main(){ int a,b,n; scanf("%d",&n); while(n--) {... 阅读全文
posted @ 2013-08-20 10:34 王莜轩 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 阶乘因式分解(二)时间限制:3000 ms | 内存限制:65535 KB难度:3描述给定两个数n,m,其中m是一个素数。将n(0int main(){ int s; scanf("%d",&s); while(s--) { int i,n,m,a=0,b=0,c=0; int count=0; scanf("%d %d",&n,&m); while(n!=0) { count+=n/m; n=n/m; } printf("%d\n",count); } return 0;}解决这道题的原理很简单,就是看看n里 阅读全文
posted @ 2013-08-19 21:38 王莜轩 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 最少乘法次数时间限制:1000 ms | 内存限制:65535 KB难度:3描述给你一个非零整数,让你求这个数的n次方,每次相乘的结果可以在后面使用,求至少需要多少次乘。如24:2*2=22(第一次乘),22*22=24(第二次乘),所以最少共2次;输入第一行m表示有m(1int main(){ int n; scanf("%d",&n); while(n--) { int m,count=1; scanf("%d",&m); if(m<=2) count=m/2; else { while(m!=2) { if(m%2==0) { 阅读全文
posted @ 2013-08-19 16:01 王莜轩 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 取石子(一)时间限制:3000 ms | 内存限制:65535 KB难度:2描述一天,TT在寝室闲着无聊,和同寝的人玩起了取石子游戏,而由于条件有限,他/她们是用旺仔小馒头当作石子。游戏的规则是这样的。设有一堆石子,数量为N(1#includeint main(){ int n; scanf("%d",&n); while(n--) { int a,b; scanf("%d %d",&a,&b); if(a<=b) printf("Win\n"); else { if(a%(b+1)==0) printf 阅读全文
posted @ 2013-08-19 11:58 王莜轩 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 数的长度时间限制:3000 ms | 内存限制:65535 KB难度:1描述 N!阶乘是一个非常大的数,大家都知道计算公式是N!=N*(N-1)······*2*1.现在你的任务是计算出N!的位数有多少(十进制)?输入首行输入n,表示有多少组测试数据(n#includeint main(){ int n; scanf("%d",&n); while(n--) { int i,m,k; double len=1; scanf("%d",&m); for(i=1;i<=m;i+ 阅读全文
posted @ 2013-08-19 00:47 王莜轩 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Dinner时间限制:100 ms | 内存限制:65535 KB难度:1描述Little A is one member of ACM team. He had just won the gold in World Final. To celebrate, he decided to invite all to have one meal. As bowl, knife and other tableware is not enough in the kitchen, Little A goes to take backup tableware in warehouse. There are 阅读全文
posted @ 2013-08-19 00:13 王莜轩 阅读(263) 评论(0) 推荐(0) 编辑
摘要: FatMouse' TradeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34126Accepted Submission(s): 11152 Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, Java 阅读全文
posted @ 2013-08-18 12:43 王莜轩 阅读(192) 评论(0) 推荐(0) 编辑
摘要: ElevatorTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34433Accepted Submission(s): 18770 Problem DescriptionThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which fl 阅读全文
posted @ 2013-08-18 11:04 王莜轩 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Number SequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 83849Accepted Submission(s): 19863Problem DescriptionA 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 阅读全文
posted @ 2013-08-17 10:49 王莜轩 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 阶乘之和时间限制:3000 ms | 内存限制:65535 KB难度:3描述给你一个非负数整数n,判断n是不是一些数(这些数不允许重复使用,且为正数)的阶乘之和,如9=1!+2!+3!,如果是,则输出Yes,否则输出No;输入第一行有一个整数0int fun1(int n){ int i=1,s=1; for(i=1;in) { break; } } if(n>=2*s) return 0; else { n-=s; fun1(n); }}int main(){ int m; scanf("%d",&m); while(m--) { int n; scanf( 阅读全文
posted @ 2013-08-15 21:21 王莜轩 阅读(287) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页