Pro.ID10124 TitleSuperprime Rib Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10124 AC98 Submit202 Ratio48.51% 时间&空间限制描述Butchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farmer John ensures that a purchaser of his prime ribs gets really prime ribs because when sliced from the right, the numbers on the ribs continue to stay prime right down to the last rib, e.g.: 7 3 3 1 The set of ribs denoted by 7331 is prime; the three ribs 733 are prime; the two ribs 73 are prime, and, of course, the last rib, 7, is prime. The number 7331 is called a superprime of length 4. Write a program that accepts a number N ( 1 ≤ N ≤ 8 ) of ribs and prints all the superprimes of that length. The number 1 (by itself) is not a prime number. 输入Multiple test cases, every case is a single line with the number N. 输出Description Butchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farmer John ensures that a purchaser of his prime ribs gets really prime ribs because when sliced from the right, the numbers on the ribs continue to stay prime right down to the last rib, e.g.: 7 3 3 1 The set of ribs denoted by 7331 is prime; the three ribs 733 are prime; the two ribs 73 are prime, and, of course, the last rib, 7, is prime. The number 7331 is called a superprime of length 4. Write a program that accepts a number N ( 1 ≤ N ≤ 8 ) of ribs and prints all the superprimes of that length. The number 1 (by itself) is not a prime number. Input Multiple test cases, every case is a single line with the number N. Output For every test case, the superprime ribs of length N, printed in ascending order one per line. Sample Input 4 Sample Output 2333 Source 样例输入4 样例输出2333 作者 |