1001. Reverse Root

Source: Internet
Author: User

 

1001. Reverse Root

Time limit: 2.0 second
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. the size of the input stream does not exceed 256 KB.

Output

For each number Ai from the last one till the first one you shoshould output its square root. Each square root shoshould 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

 

 

Code:

Using System;

Using System. Globalization;

 

PublicclassReverseRoot

{

Privatestaticvoid Main ()

{

NumberFormatInfo nfi = NumberFormatInfo. InvariantInfo;

String [] input = Console. In. ReadToEnd (). Split (

Newchar [] {'', '\ t',' \ n', '\ R'}, StringSplitOptions. RemoveEmptyEntries );

For (int I = input. Length-1; I> = 0; I --)

{

Double root = Math. Sqrt (double. Parse (input [I], nfi ));

Console. WriteLine (string. Format (nfi, "{0: F4}", root ));

}

}

}

 

Summary:

1. I learned the attribute definition In C # And found out why the Console. In attribute has the ReadToEnd () method. The Split method is followed by ReadToEnd.

2. Use the input methods ReadToEnd () and String. Split () defined by the TextReader class

3. Understand the NumberFormatInfo class and its members

4. learned the output format

 

1. An attribute is a type member that combines fields and access fields. The attribute is not necessarily a value type. It can also be an instance of a class. So there is a type of attribute. This method is available for this type! For more information, see refer to region. The ReadToEnd () method returns a string object, and the Split () method is a String class method. Therefore, the Split method can be followed by ReadToEnd. In my personal summary, it is to first execute Console. In. ReadToEnd () and then Split () The returned String object. This is also the reason why input is an array.

 

2. Method: string ReadToEnd () is the input method defined by the TextReader class. The function is to read all the characters from the current position to the end of the data stream and return them as a string. String. Split () returns a String array containing the child strings in this instance separated by the elements of the specified Char or String array. You can search for MSDN in detail.

 

3. NumberFormatInfo class. Set the value format and display the value according to the regional definition. For details, refer to MSDN.

 

4. Learned how to Format data using the String. Format () method.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.