結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-04 22:05:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 625 bytes |
| 記録 | |
| コンパイル時間 | 711 ms |
| コンパイル使用メモリ | 68,380 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-12-04 22:05:25 |
| 合計ジャッジ時間 | 2,203 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b;
cin >> a >> b;
static const int primes[] = {
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
};
static const int PRIMES_COUNT = sizeof(primes) / sizeof(primes[0]);
long sum = 0;
for (int i = 0; i < PRIMES_COUNT; ++i) {
int p = primes[i];
if (p < a || p > b) continue;
long x = p;
long fx = x*x*x - x*x + x + 1;
sum += fx;
}
cout << sum << '\n';
return 0;
}