Source Code
#include <iostream>
using namespace std;
int main() {
	string s;
	cin >> s;
	int count = 0;
	if(s[0]=='1')count++;
	if(s[1]=='1')count++;
	for(int i=2;i<s.size(); i++){
	    if(s[i]=='1'&&s[i-1]=='0'&&s[i-2]=='1'){
	        count++;
	    }
	    if(s[i]=='1'){
	        count++;
	    }
	}
	cout<<count;
	return 0;
}
Copy
Japanese holidays Alazzam
GNU G++17
3 ms
508 KB
Accepted
Test Case #1
1 ms
184 KB
Accepted
Input
1001011100101
Output
9
Judge Output
9
Checker Message
single line: '9'
Test Case #2
0 ms
192 KB
Accepted
Input
100100100
Output
3
Judge Output
3
Checker Message
single line: '3'
Test Case #3
1 ms
264 KB
Accepted
Input
011000000100111011001000001101010001001011000110100101010001000001110000011001010100011010010111111101101101101110111110101101010100100100000100010110001011001110110001110010111001001101100000101101110110010100100010101101000110001101000101001111010...
Output
488
Judge Output
488
Checker Message
single line: '488'
Test Case #4
1 ms
268 KB
Accepted
Input
110100001000111110100110110100011100011110101111010110001111000011000011011111111000001010101111101111110010101010111000011111100011110110011100000000110011101110100101000101110001111001010011110110001111011000100100001111110011001001010110010101000...
Output
263
Judge Output
263
Checker Message
single line: '263'
Test Case #5
1 ms
280 KB
Accepted
Input
011010111010001100101111110111000101101000000001001001101100011110010101010001001100010001010100000101010000001100111111000011101001001000000001110110011111111010110110011110110000000000111011111000000010000000010101100101000101001101101000000101110...
Output
395
Judge Output
395
Checker Message
single line: '395'
Test Case #6
1 ms
280 KB
Accepted
Input
11000011011111000000000111010111001100010001001111011000000000110001010100100000001000111010001111011111110010111000000001011000000011101010100111001100001000100000111010110000110010111101000110111101110010100010011000011101011101
Output
127
Judge Output
127
Checker Message
single line: '127'
Test Case #7
1 ms
280 KB
Accepted
Input
010111101101111011101101100111110011101101111000110010001110001011010010100011111000110111001000111010000000001111010010000010011011010100110000111010100011011111111111010110000100101011101111011010000101101001111100001110110010000110111011010010100...
Output
285
Judge Output
285
Checker Message
single line: '285'
Test Case #8
1 ms
340 KB
Accepted
Input
110101110111101010110101111001001101110010000101100100111101111111111101101111011011111110010010001111100000110101101011111101010011110101010111111101010011000001011011010110110111001000011011010001101000011011100111111110001010110101101001101111010...
Output
27617
Judge Output
27617
Checker Message
single line: '27617'
Test Case #9
2 ms
452 KB
Accepted
Input
000110011010101110011110100111000001101111011010011111010011000110110010111100100100110110001110101111011100100011000000000101011001011001100111001110111010010101011111000010011110010100001010000110001010001111110001010111110001011011110100000010101...
Output
40943
Judge Output
40943
Checker Message
single line: '40943'
Test Case #10
2 ms
468 KB
Accepted
Input
111001111001010000010011101101111111000100101001010011110000000010111001111100000101111001110000000111111101010110101000011010010100010001100111000100111011101111010100010010011101010011010011001100000011011101101100110010000111000111010000110101100...
Output
48186
Judge Output
48186
Checker Message
single line: '48186'
Test Case #11
3 ms
440 KB
Accepted
Input
011010001011111101110011101000011101111101010110110111011100111110111010101001101110100100001011011010101110111010101110010101101011000111001100101110100100101000011100011100010110100100010100111101000010011111110110001010100000011111011011111111011...
Output
53600
Judge Output
53600
Checker Message
single line: '53600'
Test Case #12
3 ms
508 KB
Accepted
Input
111111011111000111101101011000110001001011100010011001101010001010100010100100011111101011101101011010000101110011110001110000111101111100110010011110011100011011011010111100111001110101111010010101001100100100111011000010000000010111010101011010100...
Output
62213
Judge Output
62213
Checker Message
single line: '62213'
Test Case #13
1 ms
216 KB
Accepted
Input
101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
Output
717
Judge Output
717
Checker Message
single line: '717'
Test Case #14
0 ms
220 KB
Accepted
Input
1010101010101010101010101010101010101010101010101010101010101010101010101010
Output
75
Judge Output
75
Checker Message
single line: '75'
Test Case #15
0 ms
216 KB
Accepted
Input
10101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010
Output
193
Judge Output
193
Checker Message
single line: '193'
Test Case #16
2 ms
408 KB
Accepted
Input
101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...
Output
61419
Judge Output
61419
Checker Message
single line: '61419'
Test Case #17
1 ms
228 KB
Accepted
Input
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Output
0
Judge Output
0
Checker Message
single line: '0'
Test Case #18
0 ms
204 KB
Accepted
Input
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
Output
2235
Judge Output
2235
Checker Message
single line: '2235'
Test Case #19
1 ms
268 KB
Accepted
Input
100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100100...
Output
880
Judge Output
880
Checker Message
single line: '880'