9 degrees OJ--1163 (C ++), 9 degrees oj -- 1163
# Include <iostream>
# Include <vector>
Using namespace std;
Int main (){
Int n;
While (cin> n ){
Vector <int> vec;
Int num = 0; // num is used to record 1 ~ The number of required prime numbers in n is actually the difference between 0 and 0.
For (int I = 11; I <n; I ++ ){
Int flag = 0; // flag is intended to determine whether an integer I is a prime number. If it is a prime number, flag = 1; otherwise, flag = 0
For (int k = 2; k <I/2 + 1; k ++) {// if the condition is k <sqrt (double) I), the result is incorrect.
// Once the Division proves that I is not a prime number, you can determine the next I.
If (I % k = 0 ){
Flag = 0;
Break;
}
// Continue the loop if not exhausted
Else {
Flag = 1;
Continue;
}
}
If (flag = 0) {// I is not a prime number
Continue;
}
Else {// I is a prime number
If (I % 10 = 1) {// the bit of I is 1
Vec. push_back (I );
Num = num + 1;
Continue;
}
Else {// I is not 1
Continue;
}
}
}
If (num = 0 ){
Cout <"-1" <endl;
}
Else {
For (int m = 0; m <vec. size ()-1; m ++ ){
Cout <vec [m] <"";
}
Cout <vec [vec. size ()-1] <endl;
}
}
Return 0;
}