Compile Error
foo.cc: In function 'int main()':
foo.cc:14:68: error: expected ';' before ')' token
14 | b1[j] = ((b1[j] == '1') ? '0': '1'));
| ^
| ;
foo.cc:15:72: error: expected ';' before ')' token
15 | b1[j+1] = ((b1[j+1] == '1') ? '0': '1'));
| ^
| ;
Code
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n; int m;
cin >> n;
for (int i = 0; i < n; i++){
cin >> m; string b1; string b2;
cin >> b1; cin >> b2;
for (int j = 0; j < m - 1; j++){
if (b1[j] != b2[j]){
b1[j] = ((b1[j] == '1') ? '0': '1'));
b1[j+1] = ((b1[j+1] == '1') ? '0': '1'));
}
}
if (b1 == b2){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1233 B. Make Binary Strings Equal
- Contest
- Happy New Year 2026
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2026-01-06 15:07:32
- Judged At
- 2026-01-06 15:07:32
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes