#C7981. Special Sum Checker
Special Sum Checker
Special Sum Checker
Given an array of integers, your task is to determine whether the sum of these integers is a special number.
A number is defined as special if its decimal representation (including a negative sign if present) contains at least one of the digits 5
or 9
.
For example, if the sum of the array is 15 (which contains the digit 5), the output should be YES. If the sum is 27 (which contains neither 5 nor 9), the output should be NO.
You are required to read from stdin and output your answer to stdout.
inputFormat
The input is read from stdin and is formatted as follows:
- The first line contains a single integer n, representing the number of elements in the array.
- The second line contains n space-separated integers.
outputFormat
Output a single line to stdout containing YES
if the sum of the array is a special number, and NO
otherwise.
5
1 2 3 4 5
YES