1
//
HLOJ 1143 Accepted 15 196 708 C++
2
3 #include < iostream >
4 #include < cmath >
5 using namespace std ;
6
7 int inn ;
8 char str[ 100 ] ;
9
10 int main()
11 {
12 while ( cin >> inn )
13 {
14 bool OK = true ;
15
16 sprintf( str, " %d " , inn ) ;
17 int len = strlen( str ) ;
18 if ( len != 3 ) OK = false ;
19
20 if ( ! OK )
21 {
22 if ( OK ) printf( " Yes\n " ) ;
23 else printf( " No\n " ) ;
24
25 continue ;
26 }
27
28 int maxi = sqrt( inn * 1.0 ) ;
29 for ( int i = 2 ; i <= maxi; i ++ )
30 {
31 if ( inn % i == 0 )
32 {
33 OK = false ; break ;
34 }
35 }
36
37 for ( int i = 0 ; i < len; i ++ )
38 {
39 if ( str[i] != str[len - i - 1 ] )
40 {
41 OK = false ; break ;
42 }
43 }
44 final:
45 {
46 if ( OK ) printf( " Yes\n " ) ;
47 else printf( " No\n " ) ;
48 }
49 }
50 return 0 ;
51 }
2
3 #include < iostream >
4 #include < cmath >
5 using namespace std ;
6
7 int inn ;
8 char str[ 100 ] ;
9
10 int main()
11 {
12 while ( cin >> inn )
13 {
14 bool OK = true ;
15
16 sprintf( str, " %d " , inn ) ;
17 int len = strlen( str ) ;
18 if ( len != 3 ) OK = false ;
19
20 if ( ! OK )
21 {
22 if ( OK ) printf( " Yes\n " ) ;
23 else printf( " No\n " ) ;
24
25 continue ;
26 }
27
28 int maxi = sqrt( inn * 1.0 ) ;
29 for ( int i = 2 ; i <= maxi; i ++ )
30 {
31 if ( inn % i == 0 )
32 {
33 OK = false ; break ;
34 }
35 }
36
37 for ( int i = 0 ; i < len; i ++ )
38 {
39 if ( str[i] != str[len - i - 1 ] )
40 {
41 OK = false ; break ;
42 }
43 }
44 final:
45 {
46 if ( OK ) printf( " Yes\n " ) ;
47 else printf( " No\n " ) ;
48 }
49 }
50 return 0 ;
51 }