CSES - Datatähti 2019 loppu - Results
Submission details
Task:Bittijono
Sender:Dan Näsman
Submission time:2019-01-17 13:38:21 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:20:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < s.length(); i++) {
                 ~~^~~~~~~~~~~~
input/code.cpp:23:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(j < s.length()) {
         ~~^~~~~~~~~~~~
input/code.cpp:25:12: warning: comparison with string literal results in unspecified behavior [-Waddress]
    if(m == "1") {
            ^~~
input/code.cpp:25:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

Code

//============================================================================
// Name        : Tehtava1.cpp
// Author      : Dan
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v;

int c = 0;
string s;

int main() {
	cin >> s;

	for(int i = 0; i < s.length(); i++)	{
		int k = 0;
		int j = i;
		while(j < s.length())	{
			char m = s[j];
			if(m == "1")	{
				k++;
			}
			if(k % 2 == 0)	{
				c++;
			}
		}
	}
	cout << c;

	return 0;
}