結果
| 問題 |
No.29 パワーアップ
|
| コンテスト | |
| ユーザー |
hitoyozake
|
| 提出日時 | 2018-08-18 16:57:17 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 688 bytes |
| コンパイル時間 | 11,409 ms |
| コンパイル使用メモリ | 400,672 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-24 21:07:18 |
| 合計ジャッジ時間 | 12,484 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 5 |
コンパイルメッセージ
warning: unused variable: `x`
--> src/main.rs:4:9
|
4 | let x = std::io::stdin().read_line(& mut buf);
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
= note: `#[warn(unused_variables)]` on by default
warning: unused variable: `i`
--> src/main.rs:14:9
|
14 | for i in 0..n{
| ^ help: if this is intentional, prefix it with an underscore: `_i`
warning: unused variable: `k`
--> src/main.rs:27:10
|
27 | for (k, v) in & hashMap {
| ^ help: if this is intentional, prefix it with an underscore: `_k`
warning: variable `hashMap` should have a snake case name
--> src/main.rs:13:13
|
13 | let mut hashMap: HashMap<u64, i64> = HashMap::new();
| ^^^^^^^ help: convert the identifier to snake case: `hash_map`
|
= note: `#[warn(non_snake_case)]` on by default
ソースコード
fn get_line()->String{
let mut buf = String::new();
let x = std::io::stdin().read_line(& mut buf);
buf
}
use std::collections::HashMap;
fn main() {
let n = get_line().trim().parse::<u64>().unwrap();
let mut hashMap: HashMap<u64, i64> = HashMap::new();
for i in 0..n{
let s = get_line();
let items = s.trim().split(' ');
for item in items{
let i:u64 = item.parse::<u64>().unwrap();
*hashMap.entry(i).or_insert(0) += 1;
}
}
let mut sum = 0;
let mut amari = 0;
for (k, v) in & hashMap {
sum += v/2;
amari += v%2;
}
sum += amari / 3;
println!("{}", sum );
}
hitoyozake