Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: sundopoz
Problemset: จำนวนเฉพาะก่อนหน้า
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-08 13:10:51
/*
this is my template :>
*/
#include<iostream>
#include<cmath>
#include<array>
#include<vector>
#include<algorithm>
#include<string>
/*
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <queue>
// */
// #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef size_t st;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
template <typename T>
istream& operator>>(istream& is, vector<T>& v){
for (T& x:v) cin>>x;
return is;
}
template <typename T>
using ar = std::array<T,2>;
const int mod107=1000000007;
const int mod67=676767677;
bool isPrime(ll n){
if (n<=1) return false;
if (n<=3) return true;
if (n%2==0 || n%3==0) return false;
for (ll i = 5 ; i*i<=n;i+=6){
if (n%i==0 || n%(i+2)==0){
return false;
}
}
return true;
}
// this is my solution
auto solve(){
ll n;
cin>>n;
n--;
vector<ll> ans;
while (ans.size()<5){
if (isPrime(n)){
ans.push_back(n);
}
n--;
}
for (int i=4;i>=0;i--){
cout<<ans[i]<<" \n"[i==0];
}
return;
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
size_t testcase=1;
//cin>>testcase;
while(testcase--){
solve();
}
return 0;
}