题解 | #百钱买百鸡问题#
百钱买百鸡问题
https://www.nowcoder.com/practice/74c493f094304ea2bda37d0dc40dc85b
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> aa(3); for (int i = 0; i < 100 / 5; i++){ for (int j = 0; j < 100 / 3; j++){ int last = 100 - 5 * i - 3 * j; if(last > 0){ int k = 3 * last; if( i + k + j == 100) cout << i << " " << j << " " << k << endl; } } } } // 64 位输出请用 printf("%lld")