题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1001
1001. Reverse Root
Time limit: 2.0 second
Memory limit: 64 MB
Memory limit: 64 MB
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 ≤ 1018). 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.
Sample
input | output |
---|---|
1427 0 876652098643267843 5276538 |
2297.0716 936297014.1164 0.0000 37.7757 |
Problem Author: Prepared by Dmitry Kovalioff
Tags: problem for beginners
简单的一道题,注意下输入就可以了,还有后面要倒序输出平方根,可惜没看清题,WA了几次。。。。
贴下代码:
By LFENG
#include<stdio.h>
#include<math.h> double a[1000000]; int main() { int i=0,j; while(scanf("%lf",&a[i])!=EOF) i++; for(j=i-1;j>=0;j--) printf("%.4lf\n",sqrt(a[j])); return 0; } |