`
hunxiejun
  • 浏览: 1144096 次
文章分类
社区版块
存档分类
最新评论

杭电4002 亚洲区预赛大连赛区

 
阅读更多

这道题先是用数学公式可以推出来一个式子,接下来就是大数,,,碰到好几次大数了,以前都是用c或c++写的,这道题用c或c++实在是太麻烦,于是一咬牙,一跺脚,硬着头皮看起了Java,上午看了一点,下午问了问xd一些基本语法,于是便开始写了,既借助网上代码,又不断的问xd,终于ac了,这叫一个不容易啊,,用Java写的第一道题啊,,,,接下来再练一下Java,把nyoj上的大数题用Java再做一遍。。。。。。题目:

Euler's Totient function, φ (n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n . For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.
HG is the master of X Y. One day HG wants to teachers XY something about Euler's Totient function by a mathematic game. That is HG gives a positive integer N and XY tells his master the value of 2<=n<=N for which φ(n) is a maximum. Soon HG finds that this seems a little easy for XY who is a primer of Lupus, because XY gives the right answer very fast by a small program. So HG makes some changes. For this time XY will tells him the value of 2<=n<=N for which n/φ(n) is a maximum. This time XY meets some difficult because he has no enough knowledge to solve this problem. Now he needs your help.

Input
There are T test cases (1<=T<=50000). For each test case, standard input contains a line with 2 ≤ n ≤ 10^100.

Output
For each test case there should be single line of output answering the question posed above.

Sample Input
2 10 100

Sample Output
6 30
ac代码:



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics