提出 #5063383


ソースコード 拡げる

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(int argc, char* argv[]){
    int N;
    string S;
    cin >> N >> S;

    int white_to_black_n = 0, black_to_white_n = 0;
    const char WHITE = '.';
    const char BLACK = '#';
    if (S[0] == BLACK){
        black_to_white_n++;
    }
    for(int i = 1 ; i < S.size(); ++i){
        if (S[i] == BLACK){
            black_to_white_n++;
        }
        if (S[i-1] == BLACK && S[i] == WHITE){
            white_to_black_n++;
            S[i] = BLACK;
            // i--;
        }
    }
    cout << std::min(black_to_white_n, white_to_black_n) << endl;
    // cout << white_to_black_n << endl;


    return 0;
}

提出情報

提出日時
問題 C - Stones
ユーザ MayonPJ
言語 C++14 (GCC 5.4.1)
得点 0
コード長 732 Byte
結果 WA
実行時間 9 ms
メモリ 640 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
AC × 3
AC × 20
WA × 5
セット名 テストケース
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt, s3.txt
ケース名 結果 実行時間 メモリ
01.txt WA 9 ms 640 KiB
02.txt WA 9 ms 640 KiB
03.txt AC 9 ms 640 KiB
04.txt WA 9 ms 640 KiB
05.txt WA 9 ms 640 KiB
06.txt WA 9 ms 640 KiB
07.txt AC 8 ms 640 KiB
08.txt AC 8 ms 640 KiB
09.txt AC 8 ms 640 KiB
10.txt AC 8 ms 640 KiB
11.txt AC 8 ms 640 KiB
12.txt AC 8 ms 640 KiB
13.txt AC 8 ms 640 KiB
14.txt AC 8 ms 640 KiB
15.txt AC 8 ms 640 KiB
16.txt AC 8 ms 640 KiB
17.txt AC 8 ms 640 KiB
18.txt AC 8 ms 640 KiB
19.txt AC 1 ms 256 KiB
20.txt AC 1 ms 256 KiB
21.txt AC 1 ms 256 KiB
22.txt AC 1 ms 256 KiB
s1.txt AC 1 ms 256 KiB
s2.txt AC 1 ms 256 KiB
s3.txt AC 1 ms 256 KiB