UberOA #64
Valid String Check
Estimated EasyJudge-ready
Topics (AI-labelled)StringsBits & Math
Determine whether the integer represented by a digit string is divisible by 3 and the character 7 appears at least twice. Both conditions must hold.
This site has made the standard input and output explicit.
Input
One line containing a non-empty digit string, which may have leading 0s. On this site the length is 1..1000000.
Output
Output one integer, the answer.
Example 1
Input:
771
Output:
1
Example 2
Input:
777
Output:
1
Example 3
Input:
171
Output:
0
Example notes
Example 1: 7+7+1=15 and there are two 7s, so output 1. Example 2: the digit sum is 21 and there are three 7s, so output 1. Example 3: the digit sum 9 is divisible by 3, but there is only one 7, so output 0.
Editorial
Loading solution…