結果

問題 No.1058 素敵な数
ユーザー pockynypockyny
提出日時 2020-05-22 22:14:49
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 692 bytes
コンパイル時間 911 ms
コンパイル使用メモリ 90,604 KB
実行使用メモリ 31,592 KB
最終ジャッジ日時 2024-04-15 17:08:21
合計ジャッジ時間 5,245 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
long long num[102000] = {};
vector<long long> v;
set<long long> s;
int main(){
    long long i,j,n; cin >> n;
    for(i=2;i<=101000;i++){
        if(num[i]!=0) continue;
        for(j=i;j<=101000;j+=i){
            num[j] = i;
        }
    }
    for(i=100001;i<=101000;i++){
        for(j=100001;j<=101000;j++){
            if(s.count(i*j)==0){
                v.push_back(i*j);
                s.insert(i*j);
            }
        }
    }
    v.push_back(1);
    sort(v.begin(),v.end());
    cout << v[n - 1] << endl;
    for(i=0;i<10;i++){
        cout << v[i] << " ";
    }
    cout << endl;
}
0