C++ 算法题:购买宠物方案计数
#include
int main() { int X, A, B; cin >> X >> A >> B;
int count = 0;
for(int i = 1; i <= X/A; i++) {
if((X - i*A) % B == 0) {
count++;
}
}
cout << count << endl;
return 0;
}
原文地址: http://www.cveoy.top/t/topic/qeIf 著作权归作者所有。请勿转载和采集!