結果

問題 No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用)
ユーザー LeonardoneLeonardone
提出日時 2017-11-24 06:07:59
言語 Rust
(1.77.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 545 bytes
コンパイル時間 10,640 ms
コンパイル使用メモリ 387,528 KB
最終ジャッジ日時 2024-04-27 02:30:09
合計ジャッジ時間 11,359 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
error[E0283]: type annotations needed
  --> src/main.rs:24:13
   |
24 |         sum += get!();
   |             ^^ cannot infer type
   |
   = note: multiple `impl`s satisfying `u64: AddAssign<_>` found in the `core` crate:
           - impl AddAssign for u64;
           - impl AddAssign<&u64> for u64;

For more information about this error, try `rustc --explain E0283`.
error: could not compile `main` (bin "main") due to 1 previous error

ソースコード

diff #

// yukicoder My Practice
// author: Leonardone @ NEETSDKASU

use std::io;
use std::io::Read;

fn main() {
    
    let stdin = {
        let mut s = String::new();
        io::stdin().read_to_string(&mut s).expect("failed to read string");
        s.to_string()
    };
    
    let mut stdin = stdin.split_whitespace();
    
    macro_rules! get { () => ( stdin.next().unwrap().parse().unwrap() ) }
    
    let n: u32 = get!();
    
    let mut sum: u64 = 0;
    
    for _ in 0..n {
        sum += get!();
    }
    
    println!("{}", sum);
}
0