PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000026. Cộng chữ số hàng đơn vị (Add Modulo 10)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cộng chữ số hàng đơn vị (Add Modulo 10)
Add Modulo 10
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given an array of nonnegative integers, an operation replaces any element with . The same index can be selected repeatedly. Decide whether all elements can become equal.
Input
First line ; second line integers .
Output
Print YES if possible, otherwise NO.
Subtasks
- Subtask 1 (20 points): ;
- Subtask 2 (30 points): ;
- Subtask 3 (50 points): ;
Examples
Input
2
6 11
Output
YES
Explanation
Update to and to , so both elements become equal.