PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000191. Số vừa nguyên tố vừa đối xứng (PP Numbers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Số vừa nguyên tố vừa đối xứng (PP Numbers)
PP Numbers
Phuoc Hung OJ problem: PRIME000196
Reference: SPOJ MB1
Adaptation: one original query per PHOJ execution; subtasks are PHOJ-specific groups.
Problem statement
A PP number is both prime and a decimal palindrome. Let be the -th PP number in increasing order. Let be the product of all nonzero digits of . Print and the -th prime, counting from .
Input
One integer . (PHOJ version: one query from the original multi-case input.)
Output
Print and separated by one space.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Example
Input
5
Output
11 2
Explanation: The PP sequence begins , so . Its nonzero-digit product is ; the first prime is .