zoukankan      html  css  js  c++  java
  • 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 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

    题意 

    解析  数据会爆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 }
  • 相关阅读:
    [Docker]一键部署gitlab中文版
    [Docker]python 2.7.5 docker-compose安装
    [CentOS7]pip安装
    快速傅里叶变换FFT
    HDU 4734 f(x)
    DP
    HDU 3555 Bomb
    HDU 5898 odd-even number
    将文本拷贝到剪贴板
    数论分块
  • 原文地址:https://www.cnblogs.com/stranger-/p/7475775.html
Copyright © 2011-2022 走看看