結果

問題 No.480 合計
ユーザー t__nabe
提出日時 2020-03-26 23:00:07
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 14,673 ms
コンパイル使用メモリ 403,288 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 07:40:01
合計ジャッジ時間 11,814 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;
use std::io::Stdin;

// コピペ
struct Input {
    n: i32,
}

fn main() {
    let mut stdin = io::stdin();
    let input = read_input(&mut stdin);

    let result = (1..input.n + 1).fold(0, |a, b| a + b);
    println!("{}", result)
}

// コピペ
fn read_input(stdin: &mut Stdin) -> Input {
    let mut s = String::new();
    stdin.read_line(&mut s).expect("can't read input.");

    let n = s.trim_end().parse::<i32>().expect("can't convert to integer");
    Input { n }
}

0