1. 程式人生 > >A Math Problem

A Math Problem

code log p s miss bre tom 16px div you

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