Problem Description
Problem Analysis
I searched for ages and still couldn’t find where the original problem came fromso I had to name it this way
I felt this problem was still worth writing about
pretty interesting
The key here is the constraint on N
obviously it’s a relatively large number
So we still have to simulate it with strings
and then when checking divisibility by 2, 3 and 5 there are simpler tests
First, the check for 2 and 5
you only need to look at the last character of the string
that is, the last digit of the number
For 3, though, I still couldn’t think of a better test
so I used that theorem: if the sum of the digits is divisible by 3
then the number itself is divisible by 3
| |
No idea whether the problem link is even reachable…And the senior wouldn’t tell me where the problem came from either…-.-so inconsiderate
Problem link: 【HDU】[5585]Numbers