結果

問題 No.458 異なる素数の和
ユーザー soemono
提出日時 2020-07-24 23:58:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,161 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 79,860 KB
実行使用メモリ 180,096 KB
最終ジャッジ日時 2024-06-25 23:18:09
合計ジャッジ時間 2,733 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます

ソースコード

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