結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-30 02:12:02 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 592 bytes |
| コンパイル時間 | 14,171 ms |
| コンパイル使用メモリ | 231,784 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-09-30 17:24:04 |
| 合計ジャッジ時間 | 12,590 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
ソースコード
// No.564 背の順
package main
import (
"fmt"
"sort"
"strconv"
)
func main() {
var h, n int // なま君身長、クラス人数
fmt.Scan(&h, &n)
l := make([]int, n)
l[0] = h
for i := 1; i < n; i++ {
fmt.Scan(&l[i])
}
sort.Sort(sort.Reverse(sort.IntSlice(l)))
rank := 0
for _, v := range l {
rank++
if v == h {
switch rank {
case 1:
fmt.Println(strconv.Itoa(rank) + "st")
case 2:
fmt.Println(strconv.Itoa(rank) + "nd")
case 3:
fmt.Println(strconv.Itoa(rank) + "rd")
default:
fmt.Println(strconv.Itoa(rank) + "th")
}
break
}
}
}