标签:tac log out pid one type namespace ble closed
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=6182
题目描述: 输入N, 输出满足k^k <= N 的 k的个数
解题思路: 水水更健康
代码:
#include <iostream> #include <cstdio> #include <string> #include <vector> #include <cstring> #include <iterator> #include <cmath> #include <algorithm> #include <stack> #include <deque> #include <map> #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 #define mem0(a) memset(a,0,sizeof(a)) #define sca(x) scanf("%d",&x) #define de printf("=======\n") typedef long long ll; using namespace std; ll n; ll a[20]; ll qpower( ll a, ll b ) { ll res = 1; while( b ) { if( b & 1 ) res = res * a; b >>= 1; a = a * a; } return res; } void init() { for( int i = 1; i <= 15; i++ ) { a[i] = qpower(i, i); } // for( int i = 1; i <= 15; i++ ) { // cout << a[i] << " "; // } // cout << endl; } int main() { init(); while( cin >> n ) { int i=0; for( i = 1; i <= 15; i++ ) { // cout << n << " " << a[i] << endl; if( n < a[i] ) break; } if( i == 16 && n == 437893890380859375 ) { cout << 15 << endl; } else if( i == 16 ) { cout << 15 << endl; } else { cout << i-1 << endl; } } }
思考: 好水啊....我写这题还花了一些时间......自己中间一段时间还把自己搞糊涂了.....是真的菜
标签:tac log out pid one type namespace ble closed
原文地址:http://www.cnblogs.com/FriskyPuppy/p/7461100.html