-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2674.cpp
More file actions
54 lines (47 loc) · 978 Bytes
/
Copy path2674.cpp
File metadata and controls
54 lines (47 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <cmath>
#define fr(i, a, c) for (int i = a; i < c; i++)
#define sc1(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d %d", &a, &b)
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
int isPrimo(int n){
int count = 0;
if (n == 2) return 1;
if (n == 1 || n == 0) return 0;
for (int i = 2; i <= sqrt(n); ++i){
if (n%i == 0){
count++;
}
}
if (count >= 1) return 0;
else return 1;
}
int main(int argc, char const *argv[])
{
int a, aux,prime, super, count;
while(sc1(a) != EOF) {
prime = super = 0;
aux = a;
count = 1;
if (isPrimo(a)) {
prime = 1;
while(aux > 9){
count++;
if (isPrimo(aux%10)) super++;
else super--;
aux = aux/10;
}
if (isPrimo(aux)) super++;
else super--;
}
if (prime && (super == count)) printf("Super\n");
else if(prime) printf("Primo\n");
else printf("Nada\n");
}
return 0;
}