题解 | #百钱买百鸡问题#
百钱买百鸡问题
https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) { // 注意 while 处理多个 case
int a = 0, b = 0, c= 0;
for(int i = 0; i < 21; ++i){
for(int j = 0; j < 34; j++){
for(int k = 0; k < 301; k+=3){
if(i*5 + j*3 + k/3 == 100 && i+j+k == 100){
cout << i << " " << j << " " << k << endl;
}
}
}
}
}
}
// 64 位输出请用 printf("%lld")