title | tags | categories | author | comments | updated | permalink | mathjax | top | description | date | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|
[0166] 分数到小数 |
|
|
张学志 |
true |
false |
false |
false |
... |
2019-12-31 16:02:46 -0800 |
给定两个整数,分别表示分数的分子 numerator 和分母 denominator,以字符串形式返回小数。
如果小数部分为循环小数,则将循环的部分括在括号内。
示例 1:
输入: numerator = 1, denominator = 2 输出: "0.5"
示例 2:
输入: numerator = 2, denominator = 1 输出: "2"
示例 3:
输入: numerator = 2, denominator = 3 输出: "0.(6)"
Related Topics
class Solution {
public:
string fractionToDecimal(int numerator, int denominator) {
}
};