PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000048. Kiểm tra tình yêu bằng UCLN số nhị phân (All You Need Is Love)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Kiểm tra tình yêu bằng UCLN số nhị phân (All You Need Is Love)
All You Need Is Love
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Given two binary strings representing positive integers , test whether the two numbers have a common divisor greater than . Print the exact required phrase, using pair number .
Input
The first line contains ; the second line contains .
Output
Print Pair #1: All you need is love! if the GCD is greater than ; otherwise Pair #1: Love is not all you need!.
Subtasks
- Subtask 1 (20 points): ; Both strings represent positive binary integers.
- Subtask 2 (30 points): ; Both strings represent positive binary integers.
- Subtask 3 (50 points): ; Both strings represent positive binary integers.
Examples
Input
1100
1000
Output
Pair #1: All you need is love!
Explanation
The binary values are and with GCD , so the first message applies.