結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-28 21:30:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,049 bytes |
| コンパイル時間 | 1,942 ms |
| コンパイル使用メモリ | 194,500 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-11-28 21:31:02 |
| 合計ジャッジ時間 | 2,960 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i=(s); i<(int)(n); i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vs=vector<string>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vvvl=vector<vvl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pi=pair<int,int>;
using pl=pair<ll,ll>;
using si=set<int>;
using sl=set<long long>;
using ss=set<string>;
using svi=set<vi>;
using svl=set<vl>;
using svs=set<vs>;
using sb=set<bool>;
using vpi=vector<pi>;
using vpl=vector<pl>;
using spi=set<pi>;
using spl=set<pl>;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
template<typename T> using pq=priority_queue<T>;
int f(int a){
return a*a*a-a*a+a+1;
}
bool isprime(int a){
for(int i=2;i*i<=a;i++){
if(a%i==0)return false;
}
return true;
}
int main() {
int a,b;
cin>>a>>b;
ll ans=0;
rep2(i,a,b+1){
if(isprime(i))ans+=f(i);
}
cout<<ans<<endl;
}