Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
1833 | 孙浚轩 | 15相同数的次数 | C++ | Wrong Answer | 0 MS | 252 KB | 603 | 2023-11-12 00:03:50 |
#include <iostream> int main() { int countA = 0, countB = 0, totalCount = 1000, matchCount = 0; int numberA = 1, numberB = 1; while (countA < totalCount && countB < totalCount) { if (numberA == numberB) { matchCount++; } // 甲报数 countA++; numberA = (numberA % 20) + 1; // 保证在1~20之间循环 // 乙报数 countB++; numberB = (numberB % 30) + 1; // 保证在1~30之间循环 } std::cout << "同时报相同数字的次数: " << matchCount << std::endl; return 0; }
------Input------
0
------Answer-----
340
------Your output-----
同时报相同数字的次数: 340