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
53
54
55
56
57
58
|
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int prime[101];
int ints[101];
string s[101];
bool isPrime(int x){
int chk;
if (x >= 2){
chk = 0;
for (int i = 2; i < x; i++){
if (x%i == 0){
chk = 1;
break;
}
}
if (chk == 0){
printf("%d ", x);
return x;
}
else{
return 0;
}
}
}
int reverse(int x){
int tempi;
string temp = to_string(x);
reverse(temp.begin(), temp.end());
tempi = stoi(temp);
return isPrime(tempi);
}
int main(){
int n;
cin >> n;
int temp;
for (int i = 0; i < n; i++){
cin >> s[i];
temp = reverse(stoi(s[i]));
}
return 0;
}
|
'Programming Language > C++' 카테고리의 다른 글
C++ 가장 많이 사용된 자리의 수 (0) | 2019.10.09 |
---|---|
C++ Template Function (0) | 2019.09.29 |
C++ 최소값(min), 최대값(max) 그리고 minmax() (0) | 2019.09.28 |
C++ 문자열 정리 (String class) (0) | 2019.09.28 |
C++ Template inline function (0) | 2019.09.25 |