diff options
| author | crupest <crupest@outlook.com> | 2021-02-28 18:15:37 +0800 | 
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2021-02-28 18:15:37 +0800 | 
| commit | 844f35aeaa7766f8c76b37079b9cd50c024854b1 (patch) | |
| tree | 6bf809b2239ca4a34f25ff1ecb8a8267cb042782 /works/solutions | |
| parent | c3a1dfd2e47a6412861f27c6f1925da4f061f46d (diff) | |
| download | crupest-844f35aeaa7766f8c76b37079b9cd50c024854b1.tar.gz crupest-844f35aeaa7766f8c76b37079b9cd50c024854b1.tar.bz2 crupest-844f35aeaa7766f8c76b37079b9cd50c024854b1.zip | |
import(solutions): Add acwing 1208.
Diffstat (limited to 'works/solutions')
| -rw-r--r-- | works/solutions/acwing/1208.cpp | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/works/solutions/acwing/1208.cpp b/works/solutions/acwing/1208.cpp new file mode 100644 index 0000000..84f60f1 --- /dev/null +++ b/works/solutions/acwing/1208.cpp @@ -0,0 +1,24 @@ +#include <iostream>
 +#include <string>
 +
 +inline void toggle(char &c) { c = c == '*' ? 'o' : '*'; }
 +
 +int main() {
 +  std::string original, expected;
 +  std::cin >> original >> expected;
 +
 +  int size = original.size();
 +
 +  int count = 0;
 +
 +  for (int i = 0; i < size - 1; i++) {
 +    if (original[i] != expected[i]) {
 +      count++;
 +      toggle(original[i + 1]);
 +    }
 +  }
 +
 +  std::cout << count;
 +
 +  return 0;
 +}
 | 
