結果
| 問題 | No.564 背の順 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-08 16:22:29 |
| 言語 | Rust (1.93.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 811 bytes |
| 記録 | |
| コンパイル時間 | 1,512 ms |
| コンパイル使用メモリ | 201,612 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-02-08 16:22:32 |
| 合計ジャッジ時間 | 2,701 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 |
ソースコード
fn main() {
let stdin = std::io::read_to_string(std::io::stdin()).unwrap();
let mut stdin = stdin.split_ascii_whitespace();
let h_self: u16 = stdin.next().unwrap().parse().unwrap();
let n: usize = stdin.next().unwrap().parse().unwrap();
let h_other: Vec<u16> = (0..(n - 1))
.map(|_| stdin.next().unwrap().parse().unwrap())
.collect();
use std::io::Write;
std::io::stdout()
.write_all(output(solve(h_self, h_other)).as_bytes())
.unwrap();
}
fn solve(h_self: u16, h_other: Vec<u16>) -> usize {
h_other.into_iter().filter(|&h| h > h_self).count() + 1
}
fn output(ans: usize) -> String {
ans.to_string()
+ match ans % 10 {
1 => "st\n",
2 => "nd\n",
3 => "rd\n",
_ => "th\n",
}
}