Submission #37494256


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,now=-1;
char s[N];
int main()
{
cin>>(s+1);n=strlen(s+1);
for(int i=1;s[i];i++)
{
if(s[i]=='0'&&now==i-1) n--;
else if(s[i]=='0') now=i;
}
cout<<n;
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;

const int N=1e5+10;
int n,now=-1;
char s[N];
int main()
{
	cin>>(s+1);n=strlen(s+1);
	for(int i=1;s[i];i++)
	{
		if(s[i]=='0'&&now==i-1)	n--;
		else if(s[i]=='0')	now=i;	
	}
	cout<<n;
	return 0;
}

Submission Info

Submission Time
Task C - Cash Register
User Demeanor
Language C++ (GCC 9.2.1)
Score 300
Code Size 258 Byte
Status AC
Exec Time 8 ms
Memory 3692 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 7 ms 3564 KB
00_sample_01.txt AC 2 ms 3412 KB
00_sample_02.txt AC 1 ms 3568 KB
01_random_03.txt AC 7 ms 3656 KB
01_random_04.txt AC 8 ms 3692 KB
01_random_05.txt AC 7 ms 3504 KB
01_random_06.txt AC 6 ms 3592 KB
01_random_07.txt AC 7 ms 3656 KB
01_random_08.txt AC 7 ms 3600 KB
01_random_09.txt AC 2 ms 3436 KB
01_random_10.txt AC 2 ms 3464 KB
01_random_11.txt AC 4 ms 3508 KB
01_random_12.txt AC 2 ms 3456 KB
01_random_13.txt AC 2 ms 3428 KB
01_random_14.txt AC 5 ms 3460 KB


2025-03-05 (Wed)
12:33:08 +00:00