Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n, x, i, maxim, nr, j , ct, prim;
- cin >> n;
- maxim = 0; ct = 0;
- for (i = 1; i <= n; i++) {
- cin >> x;
- prim = 1;
- if (x < 2) {
- prim = 0;
- }
- else for (j = 2; j * j <= x; j++) {
- if (n % i == 0) {
- prim = 0;
- break;
- }
- }
- if (prim == 1 && x > maxim){
- maxim = x;
- ct = 1;
- }
- else if (prim == 1 && x == maxim) {
- ct ++;
- }
- }
- if (ct > 0) cout << maxim << " " << ct;
- else if (ct == 0) cout << "NU EXISTA";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement