1 条题解
-
1
#include <iostream> #include <string> using namespace std; int main() { string init, target; cin >> init >> target; int n = init.size(); int count = 0; for (int i = 0; i < n - 1; i++) { if (init[i] != target[i]) { // Flip at position i (affects i and i+1) init[i] = (init[i] == '*') ? 'o' : '*'; init[i + 1] = (init[i + 1] == '*') ? 'o' : '*'; count++; } } cout << count << endl; return 0; }
信息
- ID
- 1231
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 10
- 标签
- 递交数
- 4
- 已通过
- 4
- 上传者