結果

問題 No.571 3人兄弟(その2)
ユーザー ID 21712
提出日時 2025-01-12 17:37:50
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 23,409 ms
コンパイル使用メモリ 234,176 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-12 17:38:16
合計ジャッジ時間 24,971 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import . "fmt"

type X struct {
	name string
	height, weight int
}

func (x X)Less(other X) bool {
	return x.height < other.height ||
		(x.height == other.height && x.weight > other.weight)
}

func (x X)String() string {
	return x.name
}

func main() {
	var a,b,c X
	a.name = "A"
	b.name = "B"
	c.name = "C"
	Scan(&a.height, &a.weight)
	Scan(&b.height, &b.weight)
	Scan(&c.height, &c.weight)
	switch {
	case b.Less(a) && c.Less(a):
		Println(a)
		if c.Less(b) {
			Println(b)
			Println(c)
		} else {
			Println(c)
			Println(b)
		}
	case a.Less(b) && c.Less(b):
		Println(b)
		if c.Less(a) {
			Println(a)
			Println(c)
		} else {
			Println(c)
			Println(a)
		}
	case a.Less(c) && b.Less(c):
		Println(c)
		if b.Less(a) {
			Println(a)
			Println(b)
		} else {
			Println(b)
			Println(a)
		}
	}
}
0