結果

問題 No.480 合計
ユーザー nekoziroonekoziroo
提出日時 2018-05-07 15:30:54
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 16,144 ms
コンパイル使用メモリ 377,600 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 02:17:08
合計ジャッジ時間 15,559 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::stdin;

#[allow(dead_code)]
fn getline() -> String {
    let mut input = String::new();
    stdin().read_line(&mut input).ok();
    return input;
}

#[allow(dead_code)]
pub fn sum(num: i32) -> i32 {
    let mut result = 0;
    for num in 1..num + 1 {
        result += num;
    }
    return result;
}

#[allow(dead_code)]
fn main() {
    let s = getline();
    let num: i32 = s.trim().parse::<i32>().unwrap();
    println!("{}", sum(num));
}
0