結果
問題 |
No.21 平均の差
|
ユーザー |
![]() |
提出日時 | 2022-12-23 00:22:21 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 319 bytes |
コンパイル時間 | 13,203 ms |
コンパイル使用メモリ | 383,176 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 03:46:40 |
合計ジャッジ時間 | 13,406 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
warning: unused variable: `K` --> src/main.rs:11:6 | 11 | let K = read(); | ^ 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:10:6 | 10 | let N = read(); | ^ 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:11:6 | 11 | let K = read(); | ^ help: convert the identifier to snake case (notice the capitalization): `k`
ソースコード
use std::io; fn read() -> i32 { let mut line = String::new(); io::stdin().read_line(&mut line).unwrap(); line.trim().parse().unwrap() } fn main() { let N = read(); let K = read(); let mut n = vec![0; N as usize]; for i in 0..N { n[i as usize] = read(); } n.sort(); println!("{}", n[n.len() - 1] -n[0]); }