zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    [转]修改远程桌面端口
    [转]3个著名加密算法(MD5、RSA、DES)的解析
    [转]常见HTTP状态(如200,304,404,503)
    用 SqlConnectionStringBuilder 来写连接字符串,向连接字符串添加设置
    windows 设置ipsec防火墙
    网络带宽单位换算
    Linux 检查端口gps命令
    设置Linux防火墙
    windows 服务器同步互联网时间
    windows 路由转发
  • 原文地址:https://www.cnblogs.com/shinianhuanniyijuhaojiubujian/p/7463747.html
Copyright © 2011-2022 走看看