The 7th(2012) ACM Programming Contest of HUST - Preliminary Contest

From: 2012-11-17 12:00:00 To: 2012-11-17 17:00:00 Now: 2017-09-22 06:49:55 Status: Public

A - Multiple

Time Limit: 2s Memory Limit: 64MB

Submissions: 605 Solved: 159
Rocket323 loves math very much. One day, Rocket323 got a number string. He could choose some consecutive digits from the string to form a number. Rocket323 loves 64 very much, so he wanted to know how many ways can he choose from the string so the number he got multiples of 64 ?
A number cannot have leading zeros. For example, 0, 64, 6464, 128 are numbers which multiple of 64 , but 12, 064, 00, 1234 are not.
Multiple cases, in each test cases there is only one line consist a number string.
Length of the string is less than 3 * 10^5 .
Huge Input , scanf is recommended.
Print the number of ways Rocket323 can choose some consecutive digits to form a number which multiples of 64.
Sample Input
Sample Output
There are five substrings which multiples of 64.
Problem Setter : Yang Xiao