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. mac下配置和访问阿里云服务器(Ubuntu系统)

    1.购买云服务器(http://www.aliyun.com/?spm=5176.3047821.1.1.vHFBuw) 注册帐号,在产品页面选择合适的服务器,进入详细页面选择配置,购买. 购买完成后 ...

  2. [LeetCode]题解(python):053-Maximum Subarray

    题目来源 https://leetcode.com/problems/maximum-subarray/ Find the contiguous subarray within an array (c ...

  3. Windows-007-进程相关命令(netstat、tasklist、taskkill、tskill)实战实例图文详解

    本节主要讲述 Windows 系统下,nestat.tasklist.tskill 三个 CMD 命令的参数,及使用方法:以及如何利用三者结合查看进程信息和结束进程.敬请亲们参阅,希望能对亲们有所帮助 ...

  4. 通过CSS使文本框中输入的小写字母变大写字母

    在style.css文件中写 .dataField input{text-transform:uppercase;} .dataField textarea {text-transform:upper ...

  5. Excel 的一些用法--行号赋给一列

    1.鼠标选定要赋值的列 2.在 输入 =Row() 3. Ctrl+Enter

  6. inline-block元素的空白间距

    inline-block元素的空白间距 html代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN&quo ...

  7. iOS 证书及配置文件介绍

    1.Certification(证书) 证书是对电脑开发资格的认证,每个开发者帐号有一套,分为两种: 1)Developer Certification(开发证书) 安装在电脑上提供权限:开发人员通过 ...

  8. iOS发送短信

    iPhone开发,发送短信的方法: iPhone开发中,发送短信方法有二: 1.URL Scheme,这样不可以设置短信内容 1 2 3 [[UIApplication sharedApplicati ...

  9. python笔记 - day7

    python笔记 - day7 参考: http://www.cnblogs.com/wupeiqi/articles/5501365.html 面向对象,初级篇: http://www.cnblog ...

  10. 从printf("\40d\n")看转义字符

    1.  八进制  十进制  十六进制 二进制:0 1 2 3 4 5 6 7    \0(或省略0,\) ,\28 按道理是错误的,但是C语言把它解释为 \2,8错误了就不考虑 十进制:0 1 2 3 ...