欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
RecurringNumbers (google code jam china 1000分真題)
 

Problem Statement

    

Arational number is defined as a/b, where a and b are integers, and b isgreater than 0. Furthermore, a rational number can be written as adecimal that has a group of digits that repeat indefinitely. A commonmethod of writing groups of repeating digits is to place them insideparentheses like 2.85(23) = 2.852323 ... 23...

Given a decimal representation of a rational number in decimalNumber,convert it to a fraction formatted as "numerator/denominator", whereboth numerator and denominator are integers. The fraction must bereduced. In other words, the denominator must be as small as possible,but greater than zero.

Definition

    
Class: RecurringNumbers
Method: convertToFraction
Parameters: String
Returns: String
Method signature: String convertToFraction(String decimalNumber)
(be sure your method is public)
    
 

Constraints

- decimalNumber will have between 3 and 10 characters inclusive.
- decimalNumber will contain only characters ‘0‘ - ‘9‘, ‘.‘, ‘(‘ and ‘)‘.
- The second character in decimalNumber will always be ‘.‘.
- There will be at most one ‘(‘ and ‘)‘ in decimalNumber.
- ‘(‘ in decimalNumber will be followed by one or more digits (‘0‘ - ‘9‘), followed by ‘)‘.
- ‘)‘ in decimalNumber will not be followed by any other character.

Examples

0)  
    
"0.(3)"
Returns: "1/3"
0.(3) = 0.333... = 1/3
1)  
    
"1.3125"
Returns: "21/16"
Note there are no recurring digits here, although we could write it as 1.3125(0) or 1.3124(9).
2)  
    
"2.85(23)"
Returns: "14119/4950"
2.85(23)= 2.852323... = 285/100 + 23/9900 = 28238/9900 = 14119/4950. Make sureto reduce the fraction, as shown in the final step.
3)  
    
"9.123(456)"
Returns: "3038111/333000"
 
4)  
    
"0.111(1)"
Returns: "1/9"
 
5)  
    
"3.(000)"
Returns: "3/1"
 

Thisproblem statement is the exclusive and proprietary property ofTopCoder, Inc. Any unauthorized use or reproduction of this informationwithout the prior written consent of TopCoder, Inc. is strictlyprohibited. (c)2003, TopCoder, Inc. All rights reserved.



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1287925

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Objective-C Beginner's Guide
The textile technology--Twill weave
結對項目第一周
R語(yǔ)言 print函數的參數
Oracle/PLSQL: Data Types
Guid.ToString Method
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久