結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
fmhr
|
| 提出日時 | 2016-07-09 06:20:08 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,286 bytes |
| コンパイル時間 | 10,230 ms |
| コンパイル使用メモリ | 223,616 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-13 08:11:01 |
| 合計ジャッジ時間 | 11,146 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 20 |
ソースコード
package main
import (
"fmt"
"sort"
)
func main() {
var n int
fmt.Scan(&n)
m := make([]string, n)
for i := 0; i < n; i++ {
var s string
fmt.Scan(&s)
switch s[0] {
case 'D':
s = replaceAtIndex(s, 0, 'A')
case 'C':
s = replaceAtIndex(s, 0, 'B')
case 'H':
s = replaceAtIndex(s, 0, 'C')
case 'S':
s = replaceAtIndex(s, 0, 'D')
}
switch s[1] {
case 'A':
s = replaceAtIndex(s, 1, '1')
case 'T':
s = replaceAtIndex(s, 1, 'a')
case 'J':
s = replaceAtIndex(s, 1, 'b')
case 'Q':
s = replaceAtIndex(s, 1, 'c')
case 'K':
s = replaceAtIndex(s, 1, 'd')
}
m[i] = s
}
sort.Strings(m)
fmt.Println(m)
for i, s := range m {
switch s[0] {
case 'A':
s = replaceAtIndex(s, 0, 'D')
case 'B':
s = replaceAtIndex(s, 0, 'C')
case 'C':
s = replaceAtIndex(s, 0, 'H')
case 'D':
s = replaceAtIndex(s, 0, 'S')
}
switch s[1] {
case '1':
s = replaceAtIndex(s, 1, 'A')
case 'a':
s = replaceAtIndex(s, 1, 'T')
case 'b':
s = replaceAtIndex(s, 1, 'J')
case 'c':
s = replaceAtIndex(s, 1, 'Q')
case 'd':
s = replaceAtIndex(s, 1, 'K')
}
if i!=len(m)-1{
fmt.Print(" ")
}
}
fmt.Println("")
}
func replaceAtIndex(s string, index int, r rune) string{
return s[:index] + string(r) + s[index+1:]
}
fmhr