PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000028. Số nhị phân dưới đại dương (Ocean Deep! - Make it shallow!!)
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ố nhị phân dưới đại dương (Ocean Deep! - Make it shallow!!)
Ocean Deep! - Make it shallow!!
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A nonnegative integer is written in binary with possibly many bits. The bits may span multiple lines and end with a # delimiter, which is not part of the number. Determine whether its value is divisible by the prime .
Input
One or more lines of binary digits 0,1 terminated by a single #.
Output
Print YES if divisible, otherwise NO.
Subtasks
- Subtask 1 (20 points):
- Subtask 2 (30 points):
- Subtask 3 (50 points): ; Only bits
0and1appear before#.
Examples
Input
1010101#
Output
NO
Explanation
Binary 1010101 equals decimal , which is not divisible by .