HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Arithmetic > problem:


50301 - Fractions to Decimals

Guest
• Discussion of problem (1)

Section problems

• 50247 - Missing numbers
• 50267 - Interesting permutations
• 50640 - Cubes
• 50377 - kth Permutation
• 50341 - Separate Into Digits
• 50424 - Area
• 50335 - Five Math Operators
• 50299 - Median
• 50301 - Fractions to Decimals
• 50304 - Number Pattern
• 50305 - John's Tasks
• 50649 - Puzzle
• 50321 - Missing Number
• 50308 - IT Knowledge Seminars
• 50310 - Kinetic Energy
• 50314 - Falling Distance
• 50316 - Population Bar Chart

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared from USACO. Difficulty Gamma

Fractions to Decimals

USACO

Write a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 1/3 = .33333333...is denoted as 0.(3), and 41/333 = 0.123123123...is denoted as 0.(123). Use xxx.0 to denote an integer. Typical conversions are:

   1/3 = 0.(3)
   22/5 = 4.4
   1/7 = 0.(142857)
   2/4 = 0.5
   3/8 = 0.375
   45/56 = 0.803(571428)

INPUT FORMAT
A single line with two space separated integers, N and D, 1 ≤ N < D ≤ 100000.

OUTPUT FORMAT
The decimal expansion, as detailed above. If the expansion exceeds 76 characters in length, print it on multiple lines with 76 characters per line.


Sample Input I
45 56
Sample Output 1
0.803(571428)

Для отправки решений необходимо выполнить вход.

www.contester.ru