PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000314. Số dư đồng nhất (Redundant Redundancy)
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ố dư đồng nhất (Redundant Redundancy)
Redundant Redundancy
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer , find an integer satisfying both conditions:
- .
- For every integer from through , the remainder of divided by equals .
The constraints guarantee at least one valid integer . If several answers exist, you may print any valid one.
Input
One line containing integer .
Output
Print any integer satisfying all requirements.
Subtasks
- Subtask 0 (20 points): ; the output must satisfy and for every .
- Subtask 1 (30 points): ; the output must satisfy and for every .
- Subtask 2 (50 points): ; the output must satisfy and for every .
Examples
Example 1
Input
3
Output
7
Explanation
The integer lies in , and both and equal . The integer is also valid; your output need not match the sample exactly.
Example 2
Input
10
Output
39916801
Explanation
Since , and is divisible by every integer from through , the remainder is always . Another valid output is , since is divisible by each of those integers.