HDU - 6182 A Math Problem
給出一個正整數n,請數數有多少正整數k滿足k的k次方 <=n
本地打表或者通過快速冪均可
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll qpow(ll a,ll n)
{
ll prot=1;
while(n){
if(n&1) prot=prot*a;
a=a*a;
n>>=1;
}
return prot;
}
int main()
{
ll n;
while(scanf("%lld",&n)==1){
//cout<<qpow(n,n)<<endl;
int i;
for(i=1;;i++){
if(i==16) {
break;
}
if(qpow(i,i)<=n) continue;
else break;
}
printf("%d\n",i-1);
}
}
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
//const LL modd = 1000000007;
const LL s[] = { 0, 1, 4, 27, 256, 3125, 46656, 823543, 16777216, 387420489, 10000000000, 285311670611, 8916100448256,
302875106592253, 11112006825558016, 437893890380859375};
int main() {
LL n;
// for(LL i = 1 ; i <= 21; i++) {
// LL t = i;
// for(LL j = 1; j < i; j++) {
// t *= i;
// }
// printf(" %lld,", t);
//
// }
while(cin>>n){
LL ans = 0;
for(LL i = 1; i <= 15; i++) {
if( s[i] <= n ) ans++;
else break;
}
cout << ans << endl;
}
return 0;
}
相關文章
- HDU 1002 A + B Problem II
- HDU 1792 A New Change Problem
- HDU 6063 RXD and math (打表)
- Hdu 1792 A New Change Problem 結論
- HDU 2256Problem of Precision(矩陣快速冪)矩陣
- 【HDU - 1792】A New Change Problem(推公式、互質數的最大不能表示數)公式
- HDU 1792 - A New Change Problem(規律,最大不能組合數及其個數)
- [DP]HDU6415(2018多校訓練賽第九場 Problem A) Rikka with Nash Equilibrium 題解UI
- Math.round(),Math.ceil(),Math.floor
- Math
- Mathematical Problem
- Sum Problem
- HDU - 6003 Problem Buyer題解(貪心選擇演算法,鴿巢原理,優先佇列維護)演算法佇列
- hdu 2111 Saving HDU (DP)
- Math類
- Math For Programmers
- Yet Another Problem
- Nanami and the Constructive ProblemNaNStruct
- Prime Ring Problem
- 2019 MCM Problem A
- JavaScript Math.trunc vs Math.floor All In OneJavaScript
- Math函式函式
- Math.imul()
- Math.cosh()
- Math.atanh()
- Math.asinh()
- Math.random()random
- Lua math庫
- Java之MathJava
- E. Not a Nim Problem
- Nanami and the House Protecting ProblemNaN
- Problem A. Ascending Rating
- Fixed "There was a problem with the editor 'vi'"
- Prime Ring Problem (dfs)
- Shape of HDU
- HDU 3349
- HDU 2052(C語言+註釋)+HDU 2090C語言
- P1865 A % B Problem