結果
| 問題 |
No.21 平均の差
|
| ユーザー |
|
| 提出日時 | 2019-04-17 21:40:23 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 363 bytes |
| コンパイル時間 | 16,803 ms |
| コンパイル使用メモリ | 392,292 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 08:41:09 |
| 合計ジャッジ時間 | 13,528 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
warning: unused variable: `K` --> src/main.rs:9:9 | 9 | let K = read_i32(); | ^ help: if this is intentional, prefix it with an underscore: `_K` | = note: `#[warn(unused_variables)]` on by default warning: variable `N` should have a snake case name --> src/main.rs:8:9 | 8 | let N = read_i32(); | ^ help: convert the identifier to snake case: `n` | = note: `#[warn(non_snake_case)]` on by default warning: variable `K` should have a snake case name --> src/main.rs:9:9 | 9 | let K = read_i32(); | ^ help: convert the identifier to snake case (notice the capitalization): `k`
ソースコード
fn read_i32() -> i32 {
let mut line = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.trim().parse().unwrap()
}
fn main() {
let N = read_i32();
let K = read_i32();
let mut n = vec![0; N as usize];
for i in 0..N {
n[i as usize] = read_i32();
}
n.sort();
println!("{}", n[n.len() - 1] - n[0]);
}