提出 #6024710
ソースコード 拡げる
// {{{
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
// }}}
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
static constexpr int mod = (int)1e9 + 7;
static constexpr int inf = 100100100;
static constexpr ll linf = 1e18;
static constexpr double eps = 1e-9;
static constexpr double pi = 3.14159265359;
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rrep(i, n) for (ll i = n; i >= 0; --i)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define pb push_back
#define ist insert
#define fst first
#define snd second
int main() {
// cin.tie(0);
// ios_base::sync_with_stdio(false);
string S;
cin >> S;
ll cnt1 = 0, cnt2 = 0;
rep (i, S.size()) {
char c1 = i % 2 ? '1' : '0';
char c2 = i % 2 ? '0' : '1';
if (S[i] != c1) ++cnt1;
if (S[i] != c2) ++cnt2;
}
cout << min(cnt1, cnt2) << endl;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Coloring Colorfully |
| ユーザ | gochiusa |
| 言語 | C++14 (Clang 3.8.0) |
| 得点 | 300 |
| コード長 | 1301 Byte |
| 結果 | AC |
| 実行時間 | 7 ms |
| メモリ | 888 KiB |
ジャッジ結果
| セット名 | All | Sample | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 300 / 300 | 0 / 0 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| All | sample_01, sample_02, sample_03, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17 |
| Sample | sample_01, sample_02, sample_03 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| sample_01 | AC | 7 ms | 888 KiB |
| sample_02 | AC | 1 ms | 256 KiB |
| sample_03 | AC | 1 ms | 256 KiB |
| testcase_01 | AC | 4 ms | 384 KiB |
| testcase_02 | AC | 3 ms | 384 KiB |
| testcase_03 | AC | 6 ms | 512 KiB |
| testcase_04 | AC | 6 ms | 512 KiB |
| testcase_05 | AC | 6 ms | 512 KiB |
| testcase_06 | AC | 6 ms | 512 KiB |
| testcase_07 | AC | 6 ms | 512 KiB |
| testcase_08 | AC | 6 ms | 512 KiB |
| testcase_09 | AC | 1 ms | 256 KiB |
| testcase_10 | AC | 6 ms | 512 KiB |
| testcase_11 | AC | 6 ms | 512 KiB |
| testcase_12 | AC | 6 ms | 512 KiB |
| testcase_13 | AC | 6 ms | 512 KiB |
| testcase_14 | AC | 6 ms | 512 KiB |
| testcase_15 | AC | 6 ms | 512 KiB |
| testcase_16 | AC | 6 ms | 512 KiB |
| testcase_17 | AC | 6 ms | 512 KiB |