I am (one) hundred percent sure.

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了I am (one) hundred percent sure.相关的知识,希望对你有一定的参考价值。

I am (one) hundred percent sure.
感觉加了one又是多余的,你们觉得的呢,最后原因清楚些.

不多余,加one可以起到强调的作用。 参考技术A 不多余,去掉后就成了“一百个百分之了” 参考技术B 加不加都可以的,如果口语的话,不加更顺。我在美国经常听到hundred percent这个用法,就是100%的意思。 参考技术C one是一百 其他就不是一百了

2022-01-09:整数转换英文表示。将非负整数 num 转换为其对应的英文表示。 示例 1: 输入:num = 123, 输出:“One Hundred Twenty Three“。 力扣273。

2022-01-09:整数转换英文表示。将非负整数 num 转换为其对应的英文表示。
示例 1:
输入:num = 123,
输出:“One Hundred Twenty Three”。
力扣273。

答案2022-01-09:

时间紧。具体见代码。

代码用golang编写。代码如下:

package main

import (
    "fmt"
    "math"
    "strings"
)

func main() 
    num := 123
    ret := numberToWords(num)
    fmt.Println(ret)


func num1To19(num int) string 
    if num < 1 || num > 19 
        return ""
    
    names := []string"One ", "Two ", "Three ", "Four ", "Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ",
        "Eleven ", "Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", "Seventeen", "Eighteen ",
        "Nineteen "
    return names[num-1]


func num1To99(num int) string 
    if num < 1 || num > 99 
        return ""
    
    if num < 20 
        return num1To19(num)
    
    high := num / 10
    tyNames := []string"Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety "
    return tyNames[high-2] + num1To19(num%10)


func num1To999(num int) string 
    if num < 1 || num > 999 
        return ""
    
    if num < 100 
        return num1To99(num)
    
    high := num / 100
    return num1To19(high) + "Hundred " + num1To99(num%100)


func numberToWords(num int) string 
    if num == 0 
        return "Zero"
    
    res := ""
    if num < 0 
        res = "Negative "
    
    if num == math.MinInt64 
        res += "Two Billion "
        num %= -2000000000
    
    num = Abs(num)
    high := 1000000000
    highIndex := 0
    names := []string"Billion ", "Million ", "Thousand ", ""
    for num != 0 
        cur := num / high
        num %= high
        if cur != 0 
            res += num1To999(cur)
            res += names[highIndex]
        
        high /= 1000
        highIndex++
    
    return strings.Trim(res, " ")


func Abs(a int) int 
    if a < 0 
        return -a
     else 
        return a
    

执行结果如下:


左神java代码

以上是关于I am (one) hundred percent sure.的主要内容,如果未能解决你的问题,请参考以下文章

One hundred layer HDU - 4374

cf1562D Two Hundred Twenty One

CodeForces - 1562D2 Two Hundred Twenty One (hard version)(二分)

CodeForces - 1562D2 Two Hundred Twenty One (hard version)(二分)

Not until it's a hundred percent. I mean, why upset everybody over nothing.

HDOJ4374 One hundred layer