5 solutions
-
0
#include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> #include<vector> #include<string> #include<map> using namespace std; char arr1[1005]; char arr2[1005]; void op(int n)//函数操作两个字符串 { if (arr2[n] == '*') arr2[n] = 'o'; else arr2[n] = '*'; if (arr2[n+1] == '*') arr2[n+1] = 'o'; else arr2[n+1] = '*'; } int main(void) { cin.getline(arr1, 1000).getline(arr2, 1000); //数据输入 int len = strlen(arr1); int ans = 0; for (int i = 0; i < len; i++) { if (arr1[i] != arr2[i]) { ans++; op(i); } } cout << ans; //思想就是模拟翻硬币的过程 return 0; }
Information
- ID
- 1586
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 45
- Accepted
- 26
- Uploaded By