码迷,mamicode.com
首页 > 其他好文 > 详细

A Math Problem

时间:2017-08-31 23:14:58      阅读:358      评论:0      收藏:0      [点我收藏+]

标签:des   count   strong   mono   for   mis   overflow   sample   math   

A Math Problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 237    Accepted Submission(s): 117


Problem Description
You are given a positive integer n, please count how many positive integers k satisfy kkn.
 

 

Input
There are no more than 50 test cases.

Each case only contains a positivse integer n in a line.

1n1018
 

 

Output
For each test case, output an integer indicates the number of positive integers k satisfy kkn in a line.
 

 

Sample Input
1 4
 

 

Sample Output
1 2
 
直接打表从1打到15
 1 #include <bits/stdc++.h>
 2 #define ll long long int
 3 using namespace std;
 4 ll k[15]={1,4,27,256,3125,46656,823543,16777216,387420489,10000000000,
 5 285311670611,8916100448256,302875106592253,11112006825558016,437893890380859375};
 6 int main(){
 7   ll n;
 8   while(cin>>n){
 9     for(int i=14;i>=0;i--){
10       if(n>=k[i]){
11         cout<<i+1<<endl;
12         break;
13       }
14     }
15   }
16   return 0;
17 }

 

 

A Math Problem

标签:des   count   strong   mono   for   mis   overflow   sample   math   

原文地址:http://www.cnblogs.com/zllwxm123/p/7460775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!