多少个平方数小于等于X,二分。

PS:java BigInteger

import java.util.*;
import java.math.*; public class Solution {
public static void main(String args[]) {
Scanner in = new Scanner(System.in); BigInteger X = in.nextBigInteger(); BigInteger L = BigInteger.valueOf(1);
BigInteger R = BigInteger.valueOf(10).pow(500); while (L.compareTo(R) <= 0) {
BigInteger M = L.add(R).divide(BigInteger.valueOf(2));
if (M.pow(2).compareTo(X) <= 0) {
L = M.add(BigInteger.valueOf(1));
} else {
R = M.subtract(BigInteger.valueOf(1));
}
} System.out.println(R);
}
}

SGU111 Very simple problem的更多相关文章

  1. POJ 3468 A Simple Problem with Integers(线段树 成段增减+区间求和)

    A Simple Problem with Integers [题目链接]A Simple Problem with Integers [题目类型]线段树 成段增减+区间求和 &题解: 线段树 ...

  2. POJ 3468 A Simple Problem with Integers(线段树/区间更新)

    题目链接: 传送门 A Simple Problem with Integers Time Limit: 5000MS     Memory Limit: 131072K Description Yo ...

  3. poj 3468:A Simple Problem with Integers(线段树,区间修改求和)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 58269   ...

  4. ACM: A Simple Problem with Integers 解题报告-线段树

    A Simple Problem with Integers Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %l ...

  5. poj3468 A Simple Problem with Integers (线段树区间最大值)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 92127   ...

  6. POJ3648 A Simple Problem with Integers(线段树之成段更新。入门题)

    A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 53169 Acc ...

  7. BZOJ-3212 Pku3468 A Simple Problem with Integers 裸线段树区间维护查询

    3212: Pku3468 A Simple Problem with Integers Time Limit: 1 Sec Memory Limit: 128 MB Submit: 1278 Sol ...

  8. POJ 3468 A Simple Problem with Integers(线段树区间更新区间查询)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 92632   ...

  9. A Simple Problem with Integers(树状数组HDU4267)

    A Simple Problem with Integers Time Limit: 5000/1500 MS (Java/Others) Memory Limit: 32768/32768 K (J ...

随机推荐

  1. Poj 1328 / OpenJudge 1328 Radar Installation

    1.Link: http://poj.org/problem?id=1328 http://bailian.openjudge.cn/practice/1328/ 2.Content: Radar I ...

  2. Linux 配置

    零:个性化 主题:Radiance 主题颜色: gtk-color-scheme = "base_color:#CCE8CF\nfg_color:#006400\ntooltip_fg_co ...

  3. [DevExpress]ChartControl之基准线示例

    关键代码: /// <summary> /// 创建基准线ConstantLine /// </summary> /// <param name="chart& ...

  4. 5步解决移动设备上的300ms点击延迟

    译者:jmouse 大多数基于触摸的浏览器设备,在点击时都会有个 300ms 的事件触发等待时间,做过 web app 开发的同学应该都遇到过这个情况,通过下面的5步可以轻松搞定这个延迟. 1.不要太 ...

  5. 【转】perl特殊符号及默认的内部变量

    perl特殊符号及默认的内部变量,有需要的朋友不妨参考下 Perl的特殊符号 @       数组                          $x{}   x名字前面是美元符号($),后面是花 ...

  6. 谈谈java中的WeakReference

    Java语言中为对象的引用分为了四个级别,分别为 强引用 .软引用.弱引用.虚引用. 本文只针对java中的弱引用进行一些分析,如有出入还请多指正. 在分析弱引用之前,先阐述一个概念:什么是对象可到达 ...

  7. easy ui 表单元素input控件后面加说明(红色)

    <%-- 上传图片到图库基本信息且将图片关联到图集 开始--%> <div id="win_AddPicLib" class="easyui-windo ...

  8. 通过物理模型生成Java代码

    通过物理模型生成Java代码 软件开发过程中,我们一般是先针对数据库建模,物理建模完成后,生成数据库表,编码阶段的时候我们会针对数据库表生成大量的Javaeban或者是实体类 Powertdesign ...

  9. 基于SuperSocket实现的WebSocket(后端)

    关于WebSocket其实很早就想发了,奈何之前项目中的WebSocket的后端不是我做的,而我又想前后端都发出来和大家讨论讨论~于是挤出点时间研究了一下WebSocket的后端实现(所以才有了这篇文 ...

  10. iOS百度地图路径规划和POI检索详细总结-b

    路径规划.png 百度地图的使用 百度地图API的导入网上说了许多坑,不过我遇到的比较少,这里就放两个比较常见的吧.坑一: 奥联WIFI_xcodeproj.png 如上图所示,在infoplist里 ...