8000 Merge pull request #18 from tongnamuu/tongnamuu · ChoJH1998/basic-algo-lecture@70c2b16 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70c2b16

Browse files
Merge pull request encrypted-def#18 from tongnamuu/tongnamuu
boj 1439
2 parents 3e6fcd1 + 5d06b2a commit 70c2b16

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

0x11/solutions/1439.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
// Authored by : BaaaaaaaaaaarkingDog
1+
// Authored by : tongnamuu
22
// Co-authored by : -
3-
// http://boj.kr/****************
3+
// http://boj.kr/00d1d9f7116b411fb7d50c1d8cf53823
44
#include <bits/stdc++.h>
55
using namespace std;
66

7-
int main(void){
7+
int main(void) {
88
ios::sync_with_stdio(0);
99
cin.tie(0);
10-
11-
}
10+
string s;
11+
cin>>s;
12+
int len = s.length();
13+
int cnt[2] = {0,0};
14+
cnt[s[0]-'0']++;
15+
for(int i=1;i<len;++i) if(s[i]!=s[i-1]) cnt[s[i]-'0']++;
16+
cout<<min(cnt[0], cnt[1]);
17+
}

0 commit comments

Comments
 (0)
0