The problem is so easy, that the authors were lazy to write a statement for it!

Input

The input stream contains a set of integer numbers Ai (0 ≤ Ai ≤ 10^18). The numbers are separated by any number of spaces and line breaks. A size of the input stream does not exceed 256 KB.

Output

For each number Ai from the last one till the first one you should output its square root. Each square root should be printed in a separate line with at least four digits after decimal point.
 
题目大意:给一系列的Ai,求逆序的sqrt(Ai)。
思路:vector存起来逆序输出即可。看上去好像很简单,做起来实际上也是很简单。
double的精度只有15~16位,但是用double做却能AC,为何呢?当然你用long double当我没说。
随便找一个17位的数字22221111222211199
long double开平方得149067472.04608789
double       开平方得149067472.04608792
可见吃掉的精度对答案的影响相当小,完全在4位小数之后,根本就不会影响答案。
简单的说就是开方之后对精度的要求下降了导致double也可以安全AC。
 
代码(0.328S):
 #include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
using namespace std; double a;
vector<double> ans; int main() {
while(scanf("%lf", &a) != EOF) ans.push_back(sqrt(a));
for(vector<double>::reverse_iterator it = ans.rbegin(); it != ans.rend(); ++it)
printf("%.4f\n", *it);
}

URAL 1001 Reverse Root(水题?)的更多相关文章

  1. Ural 1001 - Reverse Root

    The problem is so easy, that the authors were lazy to write a statement for it! Input The input stre ...

  2. URAL 1136 Parliament 二叉树水题 BST后序遍历建树

    二叉树水题,特别是昨天刚做完二叉树用中序后序建树,现在来做这个很快的. 跟昨天那题差不多,BST后序遍历的特型,找到最后那个数就是根,向前找,比它小的那块就是他的左儿子,比它大的那块就是右儿子,然后递 ...

  3. VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh 水题

    A. Bear and Reverse Radewoosh 题目连接: http://www.codeforces.com/contest/658/problem/A Description Lima ...

  4. Timus Online Judge 1001. Reverse Root

    Input The input stream contains a set of integer numbers Ai (0 ≤ Ai ≤ 1018). The numbers are separat ...

  5. HDU 1062 Text Reverse(水题,字符串处理)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1062 解题报告:注意一行的末尾可能是空格,还有记得getchar()吃回车符. #include< ...

  6. codeforces 658A A. Bear and Reverse Radewoosh(水题)

    题目链接: A. Bear and Reverse Radewoosh time limit per test 2 seconds memory limit per test 256 megabyte ...

  7. HDU——1062Text Reverse(水题string::find系列+reverse)

    Text Reverse Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tot ...

  8. URAL 2066 Simple Expression (水题,暴力)

    题意:给定三个数,让你放上+-*三种符号,使得他们的值最小. 析:没什么好说的,全算一下就好.肯定用不到加,因为是非负数. 代码如下: #pragma comment(linker, "/S ...

  9. 1001 字符串“水”题(二进制,map,哈希)

    1001: 字符串“水”题 时间限制: 1 Sec  内存限制: 128 MB提交: 210  解决: 39[提交][状态][讨论版] 题目描述 给出一个长度为 n 的字符串(1<=n<= ...

随机推荐

  1. 通过驱动向打印机发送一段(ESC)控制指令

    这个功能看起来挺奇葩的, 写这个是因为有客户在使用驱动连接票据打印机, 但是又要开钱箱, 驱动里只能每张单据都开钱箱, 而这个打印机又不是只打印结帐单 所以就需要用软件控制打印机开钱箱 票据打印机一般 ...

  2. nrf51822-使用16位自定义UUID

    以 ble_app_uart为例 工程中创建的nus服务以及其中的两个特性值都是128位的UUID.nordic sdk中使用128位UUID的方式和标准128UUID类似,它是提供一个基准UUID, ...

  3. gridcontrol中使用右健菜单popupMenu1

    private void gridView1_ShowGridMenu(object sender, DevExpress.XtraGrid.Views.Grid.GridMenuEventArgs ...

  4. ViewModel在MVC3中的应用:实现多字段表格的部分更新

    假设我们有这样一张用户表: public class F_users { [Key] [Display(Name="用户名:")] [Required(ErrorMessage=& ...

  5. 史上最用心的iOS App上架流程【转】

    转:http://www.jianshu.com/p/16fa56eacb5e 题记 麻痹起来嗨!看网上那么多的教程,依然在我心爱的爱屁屁在上架的时候遇到各种 J8 问题,最大的问题就是:Xcode ...

  6. appium testcase1(Java)

    官网源码地址 https://github.com/appium/sample-code/blob/47fc0305396b8322b727820ca55a07607395040c/sample-co ...

  7. Maven-002-eclipse 插件安装及实例

    因为平常编码的时候,习惯了使用 eclipse 进行编码,因而需要将 eclipse 安装 maven 的插件,安装步骤如下所示: 一.安装 选择菜单: help -> Install New  ...

  8. Selenium2学习-035-WebUI自动化实战实例-033-页面快照截图应用之三 -- 区域截图(专业版)

    之前有写过两篇博文讲述了 WebUI 自动化测试脚本中常用的截图方法,敬请参阅如下所示链接: 浏览器显示区域截图 浏览器指定区域截图 那么当需要截取的区域不在浏览器显示窗口范围之内时,之前的方法显然无 ...

  9. C#类的继承

    public class Animal { public string word=""; //virtual表示虚方法,用以被重写 public virtual void say( ...

  10. 解决调用context.Session["NAME"]时总出现Object reference not set to an instance of an object.异常的方法

    if (context.Session != null) { }