結果

問題 No.480 合計
ユーザー halship
提出日時 2020-10-19 17:19:18
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 10,820 ms
コンパイル使用メモリ 378,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 07:58:56
合計ジャッジ時間 11,710 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{self, BufRead, BufReader, BufWriter, Write};

fn main() {
    let stdin = io::stdin();
    let mut stdin = BufReader::new(stdin.lock());
    let stdout = io::stdout();
    let mut stdout = BufWriter::new(stdout.lock());

    let n: u32 = read_line(&mut stdin).trim().parse().unwrap();

    let sum: u32 = (1..n + 1).sum();
    writeln!(&mut stdout, "{}", sum).unwrap();
}

fn read_line<R: BufRead>(reader: &mut R) -> String {
    let mut buf = String::new();
    reader.read_line(&mut buf).unwrap();
    buf
}
0