2017ICPC/广西邀请赛1001(水)HDU6181

Posted 灬从此以后灬

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了2017ICPC/广西邀请赛1001(水)HDU6181相关的知识,希望对你有一定的参考价值。

A Math Problem

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


Problem Description
You are given a positive integer n, please count how many positive integers k satisfy k技术分享k技术分享n技术分享 .
 

 

Input
There are no more than 50 test cases.

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

1n10技术分享18技术分享技术分享
 

 

Output
For each test case, output an integer indicates the number of positive integers k satisfy k技术分享k技术分享n技术分享 in a line.
 

 

Sample Input
1 4
 

 

Sample Output
1 2

题意 

解析  数据会爆longlong 自己快速幂找到爆点 16爆了

 1 #include <stdio.h>
 2 #include <math.h>
 3 #include <string.h>
 4 #include <stdlib.h>
 5 #include <iostream>
 6 #include <sstream>
 7 #include <algorithm>
 8 #include <string>
 9 #include <queue>
10 #include <vector>
11 using namespace std;
12 const int maxn= 200010;
13 const int inf = 0x3f3f3f3f;
14 typedef long long ll;
15 ll n;
16 ll pow1(ll a,ll b)
17 {
18   ll r=1,base=a;
19   while(b)
20   {
21     if(b&1) r*=base;
22     base*=base;
23     b>>=1;
24   }
25   return r;
26 }
27 int main(int argc, char const *argv[])
28 {
29     while(scanf("%lld",&n)==1)
30     {
31         for(int i=15;i>=0;i--)
32         {
33             if(pow1(i,i)<=n)
34             {
35                 cout<<i<<endl;
36                 break;
37             }
38 
39         }
40     }
41     return 0;
42 }

 

以上是关于2017ICPC/广西邀请赛1001(水)HDU6181的主要内容,如果未能解决你的问题,请参考以下文章

2017ACM/ICPC广西邀请赛

2017ACM/ICPC广西邀请赛-重现赛(感谢广西大学)

2017 ICPC 广西邀请赛1004 Covering

2017ACM/ICPC广西邀请赛

2017 ICPC 广西邀请赛1005 CS Course

HDU6186 2017广西邀请赛 CS Course (前缀和后缀)