Submission
Status:
-PPPPPPPPPPPPPPPPPPP
Subtask/Task Score:
95/100
Score: 95
User: solarsunny
Problemset: จำนวนเฉพาะก่อนหน้า
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-12 23:23:39
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int c=0;
int x=n;
int a[5];
while (c<5) {
x--;
bool prime= true;
for(int i=2; i*i<x; i++) {
if(x%i==0) {
prime = false;
break;
}
}
if(prime) {
a[4-c] = x;
c++;
}
}
for(int i=0; i<5; i++) {
cout << a[i] << " ";
}
cout << "\n";
}