結果
問題 | No.81 すべて足すだけの簡単なお仕事です。 |
ユーザー |
|
提出日時 | 2024-07-30 16:44:02 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 943 bytes |
コンパイル時間 | 21,804 ms |
コンパイル使用メモリ | 401,824 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-30 16:44:26 |
合計ジャッジ時間 | 15,989 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 28 |
コンパイルメッセージ
warning: unused imports: `HashMap`, `HashSet` --> src/main.rs:1:24 | 1 | use std::collections::{HashMap, HashSet}; | ^^^^^^^ ^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: unused import: `proconio::marker::Chars` --> src/main.rs:3:5 | 3 | use proconio::marker::Chars; | ^^^^^^^^^^^^^^^^^^^^^^^
ソースコード
use std::collections::{HashMap, HashSet};use proconio::marker::Chars;fn main() {proconio::input! {n: u32,mut a: [String;n],}let a = a.into_iter().map(|s| {let s = s.split('.').collect::<Vec<_>>();if s.len() == 1 {[s[0].parse::<i128>().unwrap(), 0]} else {[s[0].parse::<i128>().unwrap(),s[1].parse::<i128>().unwrap()* (10i128).pow(10 - s[1].len() as u32)* if s[0].starts_with('-') { -1 } else { 1 },]}}).collect::<Vec<_>>();for a in a.iter() {eprintln!("{a:?}");}let x = a.iter().map(|x| x[0]).sum::<i128>();let y = a.iter().map(|x| x[1]).sum::<i128>();let x = x + y / 10000000000;let y = y % 10000000000;println!("{}.{}", x, y);}