荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: kaman (天外飞仙), 信区: ACMICPC
标  题: a simply one
发信站: 荔园晨风BBS站 (Wed Apr 21 17:20:31 2004), 站内信件

Fractions to Decimals

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/2     =  1.0
3/8     =  0.375
45/56   =  0.803(571428)

PROGRAM NAME: fracdec
INPUT FORMAT
A single line with two space separated integers, N and D, 1 <= N,D <=
100000.
SAMPLE INPUT (file fracdec.in)
45 56

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 OUTPUT (file fracdec.out)
0.803(571428)

--
Long long ago,there is a hero stand at the edge of the land,a sword in
hand.......
       ︵~`   ╭)                          ▁▁
      ︸ヾ)    (╯                        ▕天外▏
      ゞ7(  ︵  ))                        ▕飞仙▏
       ╰ ︶へ︶╯                          ▔▔
       ヅ╯  ジ〉

※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.111.200]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店