013 Three Div Sequences

we are given a string called number, which represents an integer.
now we need to get the number of substrings that can be divisible by 3.
pay attention: the substring must can’t have leading zero unless it’s just zero.

of course we can do this in brute force way:
get every substrings of given string, check if it is valid.
then for every valid, parse it into int, and check if it is divisible by 3.

posted @ 2020-12-22 01:41  EvanMeetTheWorld  阅读(11)  评论(0)    收藏  举报