結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
Tehom
|
| 提出日時 | 2025-11-28 21:27:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 771 bytes |
| コンパイル時間 | 3,894 ms |
| コンパイル使用メモリ | 251,452 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-11-28 21:27:36 |
| 合計ジャッジ時間 | 4,901 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define repl(i,a,b) for(ll i=(a);i<(b);i++)
#define all(a) (a).begin(),(a).end()
template <typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;}
template <typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;} return false;}
ll f(int x){return x*x*x-x*x+x+1;}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a,b; cin >> a >> b;
vector<int> isprime(200,true);
rep(p,2,200){
if(!isprime[p]) continue;
for(int q=2*p;q<200;q+=p) isprime[q]=false;
}
ll ans=0;
rep(i,2,200){
if(isprime[i] && a<=i && i<=b) ans+=f(i);
}
cout << ans << endl;
}
Tehom