• HDU 6182 A Math


    A Math Problem

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

    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
     水题,打表。
    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <cstdio>
    #include <vector>
    #include <queue>
    #include <stack>
    #include <cstdlib>
    #include <iomanip>
    #include <cmath>
    #include <cassert>
    #include <ctime>
    #include <map>
    #include <set>
    using namespace std;
    #define lowbit(x) (x&(-x))
    #define max(x,y) (x>=y?x:y)
    #define min(x,y) (x<=y?x:y)
    #define MAX 100000000000000000
    #define MOD 1000000007
    #define pi acos(-1.0)
    #define ei exp(1)
    #define PI 3.141592653589793238462
    #define ios() ios::sync_with_stdio(false)
    #define INF 1044266558
    #define mem(a) (memset(a,0,sizeof(a)))
    typedef long long ll;
    const ll M=437893890380859375;
    ll n;
    ll quick_pow(ll x,ll y)
    {
        ll ans=1;
        while(y)
        {
            if(y&1) ans*=x;
            x*=x;
            y>>=1;
        }
        return ans;
    }
    int main()
    {
        while(scanf("%lld",&n)!=EOF)
        {
            if(n>=M) printf("15
    ");
            else
            {
                for(int i=1;i<=14;i++)
                {
                    if(quick_pow(i,i)<=n && n<quick_pow(i+1,i+1))
                    {
                        printf("%d
    ",i);
                        break;
                    }
                }
            }
        }
        return 0;
    }
  • 相关阅读:
    使用video2chars将视频转字符图
    Android调用打印机
    WPF多线程UI更新
    设计模式在JDK中的应用
    23种设计模式(概念、原则、场景、优点、缺点、应用)简述
    Bridge 、 Adapter 和 Facade 的区别
    UML类图与类的关系详解
    uml 类图依赖与关联的区别
    UML类图几种”关系“的总结
    面试官问你有什么要问的时候,大胆的提出类似问题
  • 原文地址:https://www.cnblogs.com/shinianhuanniyijuhaojiubujian/p/7463747.html
Copyright © 2020-2023  润新知