多少个平方数小于等于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 2262 / OpenJudge 2262 Goldbach's Conjecture

    1.Link: http://poj.org/problem?id=2262 http://bailian.openjudge.cn/practice/2262 2.Content: Goldbach ...

  2. Emit

    http://www.cnblogs.com/zhuweisky/archive/2008/09/20/1294666.html http://www.cnblogs.com/xiaoxiangfei ...

  3. mysql主从集群定时备份脚本

    #!/bin/bash   dpath="/mysql_backup" mydays="7" username="root" mysql_p ...

  4. centos mail 不能发邮件

    http://alfred-long.iteye.com/blog/1836488 (参考) 最近centos 6.4突然不能发邮件了, 直接用 mail命令测试也不收不到邮件 以下参考大侠们的经验后 ...

  5. [转]PHP错误日志

    对 于PHP开发者来说,一旦某个产品投入使用,应该立即将display_errors选项关闭,以免因为这些错误所透露的路径.数据库连接.数据表等信息 而遭到黑客攻击.但是,任何一个产品在投入使用后,都 ...

  6. JSON参数解析工具类

    /// <summary> /// 解析JSON参数 /// </summary> public class JSONParser { JObject jObj = null; ...

  7. xml学习总结(四)

    命名空间 (1)产生 问题:在不同的约束文档中,有不同好安逸的相同标记名称 解决办法 每个约束模式人当被赋予一个唯一的名称空间,每个名称空间可用一个唯一的URI表示 在XML实例中为来自不同模式文档的 ...

  8. OOP三类继承的区别

    OOP继承的区别提纲: 1. 普通类继承,并非一定要重写父类方法.2. 抽象类继承,如果子类也是一个抽象类,并不要求一定重写父类方法.如果子类不是抽象类,则要求子类一定要实现父类中的抽象方法.3. 接 ...

  9. Win7 64bit 成功安装ArcView3.X

    本人参考 链接 已在Win7 64Bit 笔记本上成功安装ArcView3.3,于是记录以下心得。 Win7 64Bit安装不了ArcView3.X的原因在于: 1,ArcView3.X属于16Bit ...

  10. 转载 @html.ActionLink的几种参数格式

    一 Html.ActionLink("linkText","actionName") 该重载的第一个参数是该链接要显示的文字,第二个参数是对应的控制器的方法, ...