結果

問題 No.3388 Sum of Function
コンテスト
ユーザー YU Hirose
提出日時 2026-01-09 22:06:48
言語 Rust
(1.92.0 + proconio + num)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 502 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 23,972 ms
コンパイル使用メモリ 418,104 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-01-09 22:07:47
合計ジャッジ時間 25,145 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::input;
fn main() {
    input! {
        a: usize,
        b: usize,
    }
    let mut prime = vec![];
    for i in 2..100 {
        let mut f = true;
        for j in 2..i {
            if i % j == 0 {
                f = false;
                break;
            }
        }
        if f {
            prime.push(i);
        }
    }
    let mut res = 0;
    for x in prime {
        if a <= x && x <= b {
            res += x*x*x - x*x + x + 1;
        }
    }
    println!("{}", res);
}
0