提交时间:2026-01-04 15:28:44
运行 ID: 80715
#include <iostream> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; int count = 0; // 解组数 // 枚举x的所有可能值:x >= 0 且 a*x <= c for (int x = 0; a * x <= c; x++) { int rest = c - a * x; // 计算剩下的值:b*y = rest // 检查rest是否能被b整除,且y=rest/b >= 0 if (rest % b == 0) { // 此时 y = rest / b,自动满足 y >= 0(因为rest>=0) count++; } } cout << count << endl; return 0; }