結果

問題 No.81 すべて足すだけの簡単なお仕事です。
ユーザー tabataba
提出日時 2024-07-30 17:04:58
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 985 bytes
コンパイル時間 11,538 ms
コンパイル使用メモリ 401,832 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-30 17:05:13
合計ジャッジ時間 13,176 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
6,944 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 1 ms
6,944 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
6,940 KB
testcase_26 AC 0 ms
6,944 KB
testcase_27 WA -
testcase_28 AC 0 ms
6,944 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
  |     ^^^^^^^^^^^^^^^^^^^^^^^

ソースコード

diff #

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),
                ]
            }
        })
        .collect::<Vec<_>>();
    for a in a.iter() {
        eprintln!("{a:?}");
    }
    let mut x = 0;
    let mut y = 0;
    for [i, j] in a {
        if i < 0 {
            y = j - y;
            if y < 0 {
                y += 10000000000;
                x -= 1;
            }
            x = i - x;
        } else {
            y += j;
            x += i;
        }
    }
    println!("{}.{:010}", x, y);
}
0