Fellow me on GitHub

HUD6182

A Math Problem

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


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
 

 

Source

 
 1 //2017-08-31
 2 #include <cstdio>
 3 #include <cstring>
 4 #include <iostream>
 5 #include <algorithm>
 6 #define ll long long
 7 
 8 using namespace std;
 9 
10 const int N = 20;
11 ll arr[N];
12 
13 int main()
14 {
15     for(ll i = 1; i <= 15; i++){
16         arr[i] = 1;
17         for(int j = 0; j < i; j++)
18               arr[i] *= i;
19     }
20     ll n;
21     while(cin>>n){
22         int ans = 0;
23         for(int i = 1; i <= 15; i++){
24             if(arr[i] <= n){
25                 ans++;
26             }
27         }
28         cout<<ans<<endl;
29     }
30 
31     return 0;
32 }

 

posted @ 2017-08-31 21:00  Penn000  阅读(173)  评论(0编辑  收藏  举报