C++ 购买小狗和小猫方案数量计算 - 算法题
#include "iostream"\nusing namespace std;\n\nint main() {\n int X, A, B;\n cin >> X >> A >> B;\n\n int count = 0;\n for (int i = 1; i < X; i++) {\n int j = X - i;\n if (i % A == 0 && j % B == 0) {\n count++;\n }\n }\n\n cout << count << endl;\n\n return 0;\n}
原文地址: https://www.cveoy.top/t/topic/qeIs 著作权归作者所有。请勿转载和采集!