ACM Reverse Root
2015-03-27 16:10
288 查看
Language: C#
Time limit: 2.0 second
Memory limit: 64 MB
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.
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.
以下是我的答案:
Time limit: 2.0 second
Memory limit: 64 MB
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 shouldbe 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 |
using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Text; namespace ACMTrain { class Program { static Stack<double> Tony = new Stack<double>(); static void Main(string[] args) { StringBuilder SB = new StringBuilder(); int CurrentCharInt; while ((CurrentCharInt = Console.Read()) != -1) { char CurrentChar = Convert.ToChar(CurrentCharInt); if (char.IsDigit(CurrentChar)) { SB.Append(CurrentChar); } else { PushDouble(ref SB); } } PushDouble(ref SB); while (Tony.Count > 0) { Console.WriteLine(Tony.Pop().ToString("0.0000")); } } static void PushDouble(ref StringBuilder SB) { if (SB.Length > 0) { Tony.Push(Math.Sqrt(Convert.ToDouble(SB.ToString()))); SB.Clear(); } } } }
相关文章推荐
- Ural 1001 Reverse Root 解题报告
- 寒假集训.Reverse Root
- ural 1001 Reverse Root
- Ural 1001 Reverse Root 解题报告
- URAL 1001 Reverse Root
- 杭电acmText Reverse
- 杭电ACM1321——Reverse Text~~逆序输出字符串
- Ural水题连萌之1001_Reverse Root
- Ural 1001 - Reverse Root
- URAL 1001 Reverse Root
- [hiho1579] Reverse Suffix Array [ACM-ICPC国际大学生程序设计竞赛北京赛区(2017)网络赛 B]
- Digit Root(ACM)
- URAL1001 - Reverse Root - 水题
- ural 1001 Reverse Root 水题
- Text Reverse&&http://acm.hdu.edu.cn/showproblem.php?pid=1062
- ACM-ICPC 2014北京邀请赛 H Happy Reverse [模拟]
- 一道ACM剑气算法的编程题
- Ubuntu下怎么设置Root超级账户密码
- HDOJ 2553 N皇后问题 杭电 ACM
- Phone Number 2010年山东省第一届ACM大学生程序设计竞赛