Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
115579 | 胡海峰老师 | 奇怪的国家 | C++ | Accepted | 3 MS | 272 KB | 646 | 2025-03-31 20:24:29 |
#include <iostream> #include <string> using namespace std; int main() { string person1, person2; cin >> person1 >> person2; // 读取两个人的看法 int N = person1.length(); // 获取事情的数量 string result(N, '0'); // 初始化结果字符串,长度为N,初始值为'0' for (int i = 0; i < N; ++i) { // 根据题目规则计算最终看法 if (person1[i] == person2[i]) { result[i] = '1'; // 相同则赞同 } else { result[i] = '0'; // 不同则不赞同 } } cout << result << endl; // 输出最终结果 return 0; }