360 第一题AC
#include<iostream> #include<string> using namespace std; int main(){ string str1; string str2; cin >> str1; //cout << str1 << endl; cin >> str2; int cotA_str1 = 0; int cotA_str2 = 0; int diff = 0; for (int i = 0; i < str1.length(); i++){ if (str1[i] == 'A') cotA_str1++; if (str2[i] == 'A') cotA_str2++; if (str1[i] != str2[i]) diff++; } int cot_ = abs(cotA_str1 - cotA_str2); cout << cot_ + (diff-cot_) / 2; //cout << cotA_str1 << " " << cotA_str2 << " "<<cot_<<" "<<diff; }
#360春招##360公司##笔试题目#