43152023-03-24 00:38:05tomi7Takaros Sorozat (80 pont)cpp11Wrong answer 26/806ms4952 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

long long lko(unsigned long long n, unsigned long long m){
	if(n%m==0 || m%n==0){
		return min(n, m);
	}
	if(n>m){
		return lko(n%m, m);
	}else{
		return lko(m%n, n);
	}
}

int main() {
	int n;
	cin>>n;
	string a;
	cin>>a;
	bool b=true;
	int c1=0, c0=0;
	for(int i=0;i<n;i++){
		if(a[i]=='0' && !b){
			c0++;
//			cout<<"123"<<'\n';
		}else{
			c1++;
			b=false;
		}
	}
	for(int i=n-1;i>=0;i--){
		if(a[i]=='0'){
			break;
		}else{
			c1--;
		}
	}
	cout<<min(c1, c0)<<'\n';
	cout<<min(c1, c0)<<'\n';
//	cout<<c1<<' '<<c0<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base26/80
1Wrong answer0/03ms1808 KiB
2Wrong answer0/06ms2444 KiB
3Accepted4/43ms2220 KiB
4Accepted4/43ms2428 KiB
5Partially correct2/43ms2640 KiB
6Partially correct2/43ms2884 KiB
7Partially correct2/43ms3096 KiB
8Wrong answer0/43ms3280 KiB
9Partially correct2/43ms3484 KiB
10Partially correct2/42ms3572 KiB
11Wrong answer0/43ms3696 KiB
12Partially correct2/43ms3784 KiB
13Wrong answer0/44ms4292 KiB
14Wrong answer0/44ms4252 KiB
15Partially correct2/44ms4288 KiB
16Partially correct2/44ms4532 KiB
17Wrong answer0/44ms4532 KiB
18Partially correct2/44ms4760 KiB
19Wrong answer0/44ms4844 KiB
20Wrong answer0/44ms4700 KiB
21Wrong answer0/44ms4704 KiB
22Wrong answer0/46ms4952 KiB