結果
| 問題 |
No.571 3人兄弟(その2)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-22 22:13:39 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 819 bytes |
| コンパイル時間 | 14,250 ms |
| コンパイル使用メモリ | 223,324 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 06:17:43 |
| 合計ジャッジ時間 | 15,257 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
func Scanner() string {
sc.Scan()
return sc.Text()
}
type person struct {
n string
h int
w int
}
func main() {
buf := make([]byte, 0)
sc.Buffer(buf, 100000007)
sc.Split(bufio.ScanWords)
brothers := make([]person, 3)
brothers[0].n = "A"
brothers[1].n = "B"
brothers[2].n = "C"
for i := 0; i < 3; i++ {
brothers[i].h, _ = strconv.Atoi(Scanner())
brothers[i].w, _ = strconv.Atoi(Scanner())
}
sort.Slice(brothers, func(i, j int) bool {
return brothers[i].h > brothers[j].h
})
sort.Slice(brothers, func(i, j int) bool {
if brothers[i].h == brothers[j].h {
return brothers[i].w < brothers[j].w
} else {
return false
}
})
for i := 0; i < 3; i++ {
fmt.Println(brothers[i].n)
}
}