結果

問題 No.458 異なる素数の和
ユーザー soemonosoemono
提出日時 2020-07-24 23:58:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,161 bytes
コンパイル時間 769 ms
コンパイル使用メモリ 79,760 KB
実行使用メモリ 180,172 KB
最終ジャッジ日時 2023-09-08 06:03:29
合計ジャッジ時間 2,764 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)
#include <numeric>

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define ll long long
#define assign_max(into, compared) (into = max((into), (compared)))
#define assign_min(into, compared) (into = min((into), (compared)))

using namespace std;

bool is_prime(int n){
    if (n <= 1) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;
    const int limit = min((int)sqrt(n)+1,n);
    for(int i = 3;i <= limit;i+=2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
//[2,limit]
vector<int> primenumbers(int limit){
    vector<int> primes;
    for(int i = 2;i <= limit;i++){
        if(is_prime(i)){
            primes.push_back(i);
        }
    }
    return primes;
}


int main(void){
    int n;
    cin >> n;
    auto primes = primenumbers(n);
    const int primes_n = primes.size();
    vector<vector<int>> dp (primes_n, vector<int> (n+1));
    for(int i = 0;i < primes_n;i++){
        
    }
    cout << primes.size() << endl;
}
0