結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-08-05 23:01:04 | 
| 言語 | Go (1.23.4) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 616 bytes | 
| コンパイル時間 | 11,887 ms | 
| コンパイル使用メモリ | 233,124 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-18 13:49:49 | 
| 合計ジャッジ時間 | 11,264 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
package main
import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	h, _ := strconv.Atoi(sc.Text())
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	a := make([]int, n)
	a[0] = h
	for i := 1; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	num := 0
	for i := range a {
		if h == a[i] {
			num = i + 1
			break
		}
	}
	fmt.Print(num)
	switch num % 10 {
	case 1:
		fmt.Println("st")
	case 2:
		fmt.Println("nd")
	case 3:
		fmt.Println("rd")
	default:
		fmt.Println("th")
	}
}
            
            
            
        