PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000318. Hai đèn nhấp nháy (Das Blinkenlights)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Hai đèn nhấp nháy (Das Blinkenlights)
Das Blinkenlights
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
Two lights blink at regular time intervals. Both are off at time . The first blinks at times seconds and the second at seconds. Each blink is instantaneous and does not toggle the light's state.
Given a patience limit of seconds, determine whether both lights blink together at an integer time in the inclusive interval .
Input
One line contains integers : the two blinking periods (in seconds) and the patience limit (in seconds).
Output
Print exactly yes if the lights blink together in time, or no otherwise, in lowercase.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Example 1
Input
2 5 20
Output
yes
Explanation
The first blinks at even multiples of , and the second at multiples of . Both blink at .
Example 2
Input
4 3 11
Output
no
Explanation
The first common blink is at .