Ciel and New MenuProblem code: CIEL8STR |
All submissions for this problem are available.
Chef Ciel likes 8. Ciel's restaurant has many menus whose prices are multiples of 8. Now, Ciel has some digits written on a wooden board, and she'd like to cut the board to display prices in a new menu. In how many ways can Ciel choose consecutive digits from the board which denote integer multiples of 8?
In this problem, an integer must not have leading zeros. For example, 0, 8, 48, 1000 are integer multiples of 8, but 00, 5, 58, 01000 are not.
Input
An input contains a string S, which denotes digits written on the wooden board.
Output
Print the number of ways in which Ciel can choose consecutive digits which denote integer multiples of 8.
Constraints
1 ? |S| ? 1000000 (106), where |S| means the length of S.
S doesn't contain non-digit charactors.
Sample Input
5858
Sample Output
2
Output details
Ciel can choose 5, 8, 5, 8, 58, 85, 58, 585, 858 and 5858. Here, only 8 and 8 are multiples of 8.
| Author: | laycurse |
| Date Added: | 21-11-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

> an integer must not have
@lyrically Yes. As examples
How many test cases?
@neil_812 many inputs, each
But how do we know when to
@neil_812 they are diffirent
is the explanation wrong?
@foofoo read the statement
I didn't get the problem.
@logic_max read the statement
what should be the answer for
@casy As examples say 0 is
@casy, it should be 4, not
We have to print "how many
@tarun29061990 how many
I mean to say that we have
@tarun29061990 how many ways
for 564, answer would be 1 or
@tushicomeng consider them
If the input is 000 what will
i wanna ask the same thing as
@shankey_adi 3
@randomusername the ways do
Why is O(S) solution giving
is just 0 a multiple of 8
When you submit and get WA,
TLE makes no sense!! :(
@thomasahle for the entire
@mayank.punetha huge input,
@phantom11 huge input, be
@architkhosla 0 is multiple
I guess the answer would be 2
if answer in test case is
time limit exceeding :|
I think the problem statement
@theunforgiven
i am getting run time error
@login_test statement says
@atiprashant Yes
@bonami: Please check the faq
Awesome problem ! :)
im getting TLE but ans is
Admin If i mouse hover i am
@mayank.punetha ALSO TO ALL.
@bonami check the program
@theslyguy speed up your
@Admin.............clear the
my code works absolutely fine
@satya_patel read the post
@jingo_adm : How can the o/p
@atiprashant check yourself
@crazysaikat I have not said
i am coding in java.....have
@abhi_iit_10691 try your
the output for 001000 is 6,4
@akshit_g think yourself or
I would want to see the
@coolnirdh try your best to
what is output for input
@goelrinku Think yourself.
Is it possible to submit
Should be written
I have a solution now. can i
u dereeeee..........plz i
@sharmasahil: you can submit