結果

問題 No.504 ゲーム大会(ランキング)
ユーザー myantamyanta
提出日時 2017-07-20 14:01:47
言語 Go
(1.22.1)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 14,671 ms
コンパイル使用メモリ 219,496 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-04-17 05:51:18
合計ジャッジ時間 16,662 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 268 ms
6,272 KB
testcase_08 AC 268 ms
6,272 KB
testcase_09 AC 265 ms
6,272 KB
testcase_10 AC 267 ms
6,144 KB
testcase_11 AC 266 ms
6,272 KB
testcase_12 AC 239 ms
6,272 KB
testcase_13 AC 228 ms
6,016 KB
testcase_14 AC 262 ms
6,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scnr := bufio.NewScanner(os.Stdin)
	scnr.Split(bufio.ScanWords)

	for scnr.Scan() {
		var n, k, a int
		if x, _ := fmt.Sscanf(scnr.Text(), "%d", &n); x != 1 {
			break
		}

		rank := 1
		for i := 0; i < n; i++ {
			scnr.Scan()
			fmt.Sscanf(scnr.Text(), "%d", &a)
			if i == 0 {
				k = a
			}
			if a > k {
				rank++
			}
			fmt.Println(rank)
		}
	}
}
0