标题:希望大家来帮帮忙
只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-335552-1-1.html




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

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