#GL0000307. Bội của 17 (Multiple of 17)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Bội của 17 (Multiple of 17)
Multiple of 17
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
For an integer , remove its last decimal digit and subtract from the remaining integer. The result is divisible by if and only if itself is divisible by .
For example, the transformation sends to , which is divisible by , while it sends to , which is not.
Given a positive integer that can be as large as , determine whether it is divisible by . The number may exceed the range of ordinary integer types.
Input
One line contains the positive decimal integer , without leading zeros.
Output
Print 1 if is divisible by , otherwise print 0.
Subtasks
- Subtask 1 (20 points): ; is written in decimal without leading zeros.
- Subtask 2 (30 points): ; is written in decimal without leading zeros.
- Subtask 3 (50 points): ; is written in decimal without leading zeros.
Examples
Example 1
Input
34
Output
1
Explanation
Removing from leaves . Since is divisible by , print 1.
Example 2
Input
201
Output
0
Explanation
Removing from leaves . Since is not divisible by , print 0.
Example 3
Input
2098765413
Output
1
Explanation
Since , the given number is divisible by , so the answer is 1.
Example 4
Input
1717171717171717171717171717171717171717171717171718
Output
0
Explanation
The number consists of 25 repetitions of 17, followed by 18. The first 50 digits form a multiple of . Appending 18 gives remainder , so the answer is 0.