| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 380 人关注过本帖
标题:希望大家来帮帮忙
只看楼主 加入收藏
katherine2o1
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-3
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:4 
希望大家来帮帮忙
KO is a Taobao engineer at infrastructure team. He likes thinking, especially about math and algorithm problem. One day a math puzzle comes to his mind.

Let’s define an equation as follow:


f[1][j] = j, j >= 1;


f[i][1] = 1, i >= 1;


f[i][j] = f[i][j-1] * f[i-1][j], i > 1 and j > 1;


Given two integers n, m, how to calculate the value of f[n][m] mod 109?
 

Input
The first line of the input is an integer T (T <= 1000), which stands for the number of test cases you need to solve.

Every test case are two integers n, m (1 <= n, m <= 109).

 

Output
For every test case, you should output "Case #k: " first, where k indicates the case number and starts at 1. Then the answer f[n][m] mod 109. See sample for more details.
 

搜索更多相关主题的帖子: Taobao test 
2011-04-03 15:41
katherine2o1
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-3
收藏
得分:0 
回复 楼主 katherine2o1
那个不是109,是1000000000,复制的时候错了。。
2011-04-03 15:52
katherine2o1
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-3
收藏
得分:0 
都没人来吗。。悲剧了。。
2011-04-03 18:02
vykylai
Rank: 2
等 级:论坛游民
帖 子:5
专家分:37
注 册:2011-3-27
收藏
得分:14 
你这是C
2011-04-03 18:29
katherine2o1
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-4-3
收藏
得分:0 
回复 4楼 vykylai
可以用其他语言啊,只要能编出程序就好了。。呵呵
2011-04-03 18:58
快速回复:希望大家来帮帮忙
数据加载中...
 
   



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

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