#SP0000037. Vùng đất số nguyên tố (Prime Land)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Vùng đất số nguyên tố (Prime Land)
Prime Land
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
In Prime Land, an integer is represented using pairs , meaning prime occurs to exponent in the factorization of . Only primes with positive exponents appear, in decreasing order of .
You are given the representation of . Subtract one and output the prime-power representation of , also with primes in decreasing order. For example, 5 1 2 1 means , so .
Input
One line containing an even number of positive integers . Each is prime and ; . They represent .
Output
Print the prime-exponent pairs of on one line separated by spaces, in decreasing prime order.
Subtasks
- Subtask 1 (20 points): ; ; các là số nguyên tố đôi một phân biệt theo thứ tự giảm dần; ; .
- Subtask 2 (30 points): ; ; các là số nguyên tố đôi một phân biệt theo thứ tự giảm dần; ; .
- Subtask 3 (50 points): ; ; các là số nguyên tố đôi một phân biệt theo thứ tự giảm dần; ; .
Examples
Input
17 1
Output
2 4
Explanation
Input 17 1 represents . Then , so the output is 2 4.
Input
5 1 2 1
Output
3 2
Explanation
The input pairs represent . Subtracting one gives , printed as 3 2.