結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-28 21:48:06 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 465 bytes |
| コンパイル時間 | 3,270 ms |
| コンパイル使用メモリ | 275,656 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-11-28 21:48:10 |
| 合計ジャッジ時間 | 4,241 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
bool isprime(int n){
if(n<2)return false;
for(int i=2;i*i<=n;i++){
if(n%i == 0)return false;
}
return true;
}
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int a,b;cin>>a>>b;
int ans=0;
for(int i=a;i<=b;i++){
if(isprime(i)){
ans += i*i*i-i*i+i+1;
}
}
cout<<ans;
return 0;
}