| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 893 人关注过本帖
标题:大数问题
只看楼主 加入收藏
lianxinkai
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2006-3-3
收藏
 问题点数:0 回复次数:4 
大数问题

Lazy girl
Time Limit : 1 seconds Memory Limit : 10MB

Tracy and her classmates are learning combinatory. Today’s homework is to calculate some equation like. Tracy is a lazy girl, so she decides to calculate them with computer. Suppose you are the computer, then what’s the answer?


Input:

The input file contains several test cases. For each test case:
There’s only one line containing two integers n (n>=1) and k (0<=k<=n). Input is terminated by two zeroes for n and k.

Output:

For each test case, print one line containing the required number. This number will always fit into an 64-bit integer, i.e. it will be less than 263.

Sample Input:

4 2
10 5
49 6
0 0
Sample Output:

6
252
13983816

搜索更多相关主题的帖子: 大数 Limit Input computer test 
2006-10-21 14:29
计院人
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2006-10-15
收藏
得分:0 
弄成汉语行不?

2006-10-21 16:10
子余
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-10-22
收藏
得分:0 
# include<stdio.h>
long int f(int n,int r)
{
if (r==0||r==n)
return 0;
else
return f(n-1,r-1)+f(n-1,r-1);
}
int main()
{
int n,r;
long int t;
scanf("%d %d",&n,&r);
while(n!=0&&r!=0)
{
t=f(n,r);
printf("%ld\n",t);
scanf("%d %d",&n,&r);
}
return 0;
}
2006-10-22 02:37
子余
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-10-22
收藏
得分:0 
呵呵!
这个肯定会超时的!!
2006-10-22 02:37
nuciewth
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:我爱龙龙
等 级:贵宾
威 望:104
帖 子:9786
专家分:208
注 册:2006-5-23
收藏
得分:0 

这个是昨天的ACM竞赛题目.
翻译一下:
懒惰的女孩
时间限制:1S 内存限制:10M
特蕾西和她的同学正在学习组合数,今天她们的作业句是计算如下的等式.特蕾西是一个非常懒惰的女孩,于是她决定运用计算机帮它解决,假设,你就是计算机,问这些答案是什么?
输入:
输入文件要包含多组测试数据,对于每组测试数据:
每行包括两个整数n (n>=1) and k (0<=k<=n).以给n,k输入0结束测试.

输出:
对每组测试数据,每行显示一个要求的数,这个数适用于64位整型.也就是小于263.

/*也不知道这样翻可以不,反正知道意思就可以了.*/


倚天照海花无数,流水高山心自知。
2006-10-22 10:33
快速回复:大数问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011618 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved