結果

問題 No.3388 Sum of Function
コンテスト
ユーザー elphe
提出日時 2025-11-28 22:35:08
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 18,011 ms
コンパイル使用メモリ 397,612 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-28 22:35:27
合計ジャッジ時間 18,345 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::{input, fastout};

#[fastout]
fn main() {
	input! {
		a: u32,
		b: u32,
	}
	
	println!("{}", output(solve(a, b)));
}

fn solve(a: u32, b: u32) -> u32 {
	const PRIMES: [u32; 25] = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];
	let mut ans = 0;
	for p in PRIMES.into_iter().filter(|x| *x >= a && *x <= b) {
		ans += p * (p * (p - 1) + 1) + 1;
	}
	ans
}

fn output(ans: u32) -> u32 {
	ans
}
0