結果

問題 No.39 桁の数字を入れ替え
ユーザー fmhr
提出日時 2016-06-25 18:27:00
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 440 bytes
コンパイル時間 12,518 ms
コンパイル使用メモリ 236,992 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 06:58:22
合計ジャッジ時間 12,938 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	sRune := []rune(s)
	n := make([]rune, len(sRune))
	max := make([]rune, len(sRune))
	copy(max, sRune)
	for i:=0; i<len(s)-1; i++{
		for j:=i; j<len(s); j++{
			copy(n, sRune)
			n[i], n[j] = n[j], n[i]
			for k:=0; k<len(s); k++{
				if max[k] < n[k]{
					copy(max, n)
					break
				}else if max[k] > n[k]{
					break
				}
			}
		}
	}
	fmt.Println(string(max))
}
0