#P16302. [蓝桥杯 2026 省 Java C 组] 幸运约会日
[蓝桥杯 2026 省 Java C 组] 幸运约会日
Problem Description
Xiaoming is a romantic programmer. He wants to confess his feelings to the girl he likes on a special date. He believes that if the digit sums of the three numbers year, month, and day of a date are all equal, then this is a "lucky date day".
A digit sum means the sum of all digits of a number. For example:
- The digit sum of is .
- The digit sum of is .
- The digit sum of is .
Given a date, please help Xiaoming determine whether it is a lucky date day.
Input Format
The first line contains an integer , indicating the number of test cases.
The next lines each contain three integers , , and , representing the year, month, and day, respectively.
Output Format
For each test case, if it is a lucky date day, output YES; otherwise output NO.
3
2026 12 7
2020 4 13
1111 1 3
NO
YES
NO
Hint
Sample Explanation
- The first date: December 7, 2026. The digit sum of 2026: . The digit sum of 12: . The digit sum of 7: . Since , it is not a lucky date day.
- The second date: April 13, 2020. The digit sum of 2020: . The digit sum of 4: . The digit sum of 13: . Since , it is a lucky date day.
- The third date: January 3, 1111. The digit sum of 1111: . The digit sum of 1: . The digit sum of 3: . Since , it is not a lucky date day.
Constraints
For all test cases, , (guaranteed to be a valid year), (guaranteed to be a valid month), and (guaranteed to be a valid date). It is guaranteed that the given dates are all real and valid dates.
Translated by ChatGPT 5