結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-02-10 02:09:02 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 742 bytes |
| 記録 | |
| コンパイル時間 | 1,242 ms |
| コンパイル使用メモリ | 100,336 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-02-10 02:09:06 |
| 合計ジャッジ時間 | 2,800 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 3 |
ソースコード
// Online C++ compiler to run C++ program online
#include <iostream>
#include<vector>
#include<cmath>
using namespace std;
bool isPrime(int n){
for(int i=2; i<n; i++){
if(n%i == 0)
return false;
}
return true;
}
int answer(int min, int max){
int ans = 0;
for(int i=min; i<=max; i++){
bool val = isPrime(i);
if(val)
ans += pow(i,3) - pow(i,2) + i + 1;
}
return ans;
}
int main() {
int min, max;
cin>>min>>max;
int ans = answer(min, max);
cout<<ans<<endl;
// while(n>0){
// --n;
// int days, calories;
// cin>>days;
// cin>>calories;
// answer(days, calories);
// // cout<<ans<<endl;
// }
return 0;
}
vjudge1