Submission
Status:
PPPPPPPPPPPPPPPPTTPP
Subtask/Task Score:
90/100
Score: 90
User: Catpao
Problemset: จำนวนเฉพาะก่อนหน้า
Language: cpp
Time: 1.045 second
Submitted On: 2025-09-29 08:42:14
#include<bits/stdc++.h>
using namespace std;
int b[10];
int main()
{
int n,d,cnt = 0;
cin>>n;
bool a = false;
set<int> c;
for(int i=n-1;i>=2;i--){
d = i;
for(int j=2;j<d;j++){
if(d%j == 0){
a = true;
}
}
if(a == false){
c.insert(d);
cnt++;
if(cnt == 5){
break;
}
}
a = false;
}
for(auto e:c){
cout<< e << ' ';
}
}