結果

問題 No.2609 Decreasing GCDs
ユーザー inksamuraiinksamurai
提出日時 2024-01-19 22:19:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,156 bytes
コンパイル時間 2,810 ms
コンパイル使用メモリ 207,028 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-19 22:19:56
合計ジャッジ時間 3,294 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int ll
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _48SMghu ios::sync_with_stdio(0),cin.tie(0)
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}

const int lim=1e8;

bool isprime(int n){
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0){
			return 0;
		}
	}
	return 1;
}

void slv(){
	int n=25;
	vi pris;
	for(int x=3;;x++){
		if(sz(pris)==n-1) break;
		if(isprime(x)){
			pris.pb(x);
		}
	}
	pris.insert(pris.begin(),1);
	reverse(pris.begin(), pris.end());
	vi a(n);
	rep(i,n){
		a[i]=pris[i]*(!i?1:pris[i-1]);
	}
	rng(i,1,n){
		int x=a[i-1],y=a[i];
		int p=i%2?3:2;
		while(x>=y){
			y*=p;
		}
		if(y>lim){
			break;
		}
		a[i]=y;
	}
	a[n-2]=a[n-3]+2;
	a[n-1]=a[n-2]+1;
	int l;
	cin>>l;
	rep(i,l){
		cout<<a[i]<<" ";
	}
	cout<<"\n";
}

signed main(){
_48SMghu;
	slv();
}
0