Submission

Status:

PPPPPTTTTTPPTTTTTTTT

Subtask/Task Score:

35/100

Score: 35

User: Catpao

Problemset: จำนวนเฉพาะก่อนหน้า

Language: cpp

Time: 1.097 second

Submitted On: 2025-09-29 08:36:17

#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=2;i<n;i++){
		d = i;
		for(int j=2;j<d;j++){
			if(d%j == 0){
				a = true;
			}
		}
		if(a == false){
			c.insert(d);
		}
		a = false;
	}
	for(auto  e:c){
		cnt++;
		if(c.size() - 5 < cnt){
			cout<< e << ' ';
		}
	}
}