A Math Problem

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

Problem Description

You are given a positive integer n, please count how many positive integers k satisfy kk≤n.
 

Input

There are no more than 50 test cases.

Each case only contains a positivse integer n in a line.

1≤n≤1018

 

Output

For each test case, output an integer indicates the number of positive integers k satisfy kk≤n in a line.
 

Sample Input

1
4
 

Sample Output

1
2
 

Source

 
 //2017-08-31
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long using namespace std; const int N = ;
ll arr[N]; int main()
{
for(ll i = ; i <= ; i++){
arr[i] = ;
for(int j = ; j < i; j++)
arr[i] *= i;
}
ll n;
while(cin>>n){
int ans = ;
for(int i = ; i <= ; i++){
if(arr[i] <= n){
ans++;
}
}
cout<<ans<<endl;
} return ;
}

HUD6182的更多相关文章

随机推荐

  1. 常用的SQL调优

    1. 不要使用 select * ,使用select *的话会增加解析的时间,另外会把不需要的数据也给查询出来,数据传输也是耗费时间的. 2.  避免在 where 子句中使用 or 来连接条件,可以 ...

  2. 一步一步教你用 Vue.js + Vuex 制作专门收藏微信公众号的 app

    一步一步教你用 Vue.js + Vuex 制作专门收藏微信公众号的 app 转载 作者:jrainlau 链接:https://segmentfault.com/a/1190000005844155 ...

  3. Python(28)---模块和包的基本概念

    一.模块 定义:在python中,一个 .py 文件就称为一个模块 使用模块的好处:最大的好处就是提高了代码的可维护性 分类(三种): python标准库 第三方模块 应用程序自定义模块 模块导入方法 ...

  4. 【sping揭秘】2、关于spring配置文件

    <import>标签 引入其他的配置文件,如果A.xml 中的<bean>定义可能依赖B.xml中的某些<bean>定义,那么可以再A.xml中使用这种方式< ...

  5. POJ 2575

    #include<iostream> #include<set> #include<stdio.h> using namespace std; int my_abs ...

  6. 九浅一深ThreadLocal

    ThreadLocal的作用.使用示例 ThreadLocal是线程的本地存储,存储在其内的值只能被当前线程访问到,其他线程获取不到,可以存储任意对象.经常用来存储当前线程的一些上下文信息,这样不用通 ...

  7. windows cmd窗口提示“telnet”命令不能内部或外部命令,也不是可运行的程序

    windows cmd窗口提示“telnet”命令不能内部或外部命令,也不是可运行的程序 原因:C:\Windows\System32目录下没有telnet.exe,path系统变量的值包含了C:\W ...

  8. Redis 缓存服务配置与使用

    缓存服务器Couchbase另外一种选择Redis documentation http://redis.io/documentation http://redis.cn/documentation. ...

  9. IdentityServer4 Hybrid 模式

    原文参考:Switching to Hybrid Flow and adding API Access back 接上篇:IdentityServer-Protecting an API using ...

  10. Java总结:语法基础

    更新时间:2018-1-7 10:34:05 更多请查看在线文集:http://android.52fhy.com/java/index.html Hello World 文件名:HelloWorld ...