結果

問題 No.2609 Decreasing GCDs
ユーザー applejam
提出日時 2025-01-25 18:36:22
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 669 bytes
コンパイル時間 2,876 ms
コンパイル使用メモリ 132,636 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-25 18:36:26
合計ジャッジ時間 3,907 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
#define rep(i, n) for (int i = 0; i< (int)(n); i++) 

bool isprime(ll a){
    if(a < 2)return false;
    for(ll i = 2; i*i <= a; i++){
        if(a%i == 0)return false;
    }
    return true;
}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    ll a = 1;
    ll base = 1;rep(i, n-1)base *= 2;
    rep(i, n){
        while(!isprime(a))a++;
        cout << base*a << " ";
        a += a+1;
        base /= 2;
    }cout << endl;

    return 0;
}
0