結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-02-10 02:37:01 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 758 bytes |
| 記録 | |
| コンパイル時間 | 5,010 ms |
| コンパイル使用メモリ | 203,472 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-02-10 02:37:12 |
| 合計ジャッジ時間 | 6,165 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
// Online compiler C++
#include<bits/stdc++.h>
using namespace std ;
#define nl "\n"
#define int long long
using vi = vector<int> ;
void solve() {
int a , b ;
cin >> a >> b ;
int res = 0 ;
for( int i = a ; i <= b ; i++ ) {
int temp = i ;
if( temp != 2 && temp % 2 == 0 ) continue ;
else if( temp == 1 ) continue ;
bool f = true ;
for( int j = 2 ; j * j <= i ; j++ ) {
if( i % j == 0 ) {
f = false ;
break ;
}
}
if( f ) res += pow( i , 3 ) - pow( i , 2 ) + i + 1 ;
}
cout << res << nl ;
}
signed main() {
int t = 1 ;
// cin >> t ;
while( t-- ) {
solve() ;
}
return 0 ;
}
vjudge1