Submission
Status:
PPPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: UNJE0o
Problemset: จำนวนเฉพาะก่อนหน้า
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-15 14:53:41
#include <bits/stdc++.h>
#define en '\n'
using namespace std;
typedef long long ll;
// vector <int> n = {}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
vector<long long> n;
int s = 0,b;cin >> b;
for(int i = b-1;i >= 0;i--){//3
bool c = true;
for(int j = 2;j <= ceil((float)(sqrt(i)));j++){
if(i % j == 0){
c = false;
break;
}
}
if(c == true) {
n.push_back(i);
s+=1;
}
if(s == 5 )break;
}
sort(n.begin(),n.end());
for(auto x:n) cout << x <<" ";
}