結果

問題 No.3388 Sum of Function
コンテスト
ユーザー syoyudango
提出日時 2025-11-29 00:55:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 2,927 ms
コンパイル使用メモリ 275,464 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-29 00:56:02
合計ジャッジ時間 4,021 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

int f(int x) {
    return x * x * x - x * x + x + 1;
}

int main() {
    int A, B;
    cin >> A >> B;
    int ans = 0;
    for (int i = A; i <= B; i++) {
        bool isPrime = true;
        for (int j = 2; j <= i - 1; j++) {
            isPrime &= i % j != 0;
        }
        if (isPrime) {
            ans += f(i);
        }
    }
    cout << ans << endl;
    return 0;
}
0