結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー GoryudyumaGoryudyuma
提出日時 2015-08-13 00:29:56
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,120 bytes
コンパイル時間 12,392 ms
コンパイル使用メモリ 224,124 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 03:19:25
合計ジャッジ時間 12,313 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
        "bufio"
        "fmt"
        "os"
        "sort"
        "strconv"
        "strings"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
        i, e := strconv.Atoi(nextString())
        if e != nil {
                panic(e)
        }
        return i
}

func nextInt64() int64 {
        i, e := strconv.ParseInt(nextString(), 10, 64)
        if e != nil {
                panic(e)
        }
        return i

}

func nextFloat() float64 {
        f, e := strconv.ParseFloat(nextString(), 64)
        if e != nil {
                panic(e)
        }
        return f
}

func nextString() string {
        sc.Split(bufio.ScanWords)
        sc.Scan()
        return sc.Text()
}
func Reverse(s string) string {
        runes := []rune(s)
        for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
                runes[i], runes[j] = runes[j], runes[i]
        }
        return string(runes)
}

func main() {
        N := nextString()
        X := strings.Split(N, "")
        sort.Strings(X)
        Y := strings.Join(X[:], "")
        Z := Reverse(Y)
        fmt.Println(Z)
}
0