結果
| 問題 | No.3114 0→1 |
| コンテスト | |
| ユーザー |
sig_256
|
| 提出日時 | 2025-04-19 14:00:16 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 343 bytes |
| コンパイル時間 | 2,816 ms |
| コンパイル使用メモリ | 76,508 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-19 14:00:20 |
| 合計ジャッジ時間 | 3,103 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
int main(){
int N, ans = 0;
std::string S;
std::cin >> N >> S;
if(N > 1) if((S[0] | S[1]) == '0') S[1] = '1', ans ++;
for(int n = 2; n < N; ++n){
if(S[n] != '0') continue;
if(S[n - 2] == '0'){
S[n] = '1';
ans ++;
}
if(S[n - 1] == '0'){
S[n] = '1';
ans ++;
}
}
std::cout << ans << std::endl;
}
sig_256