题解 | #鸡兔同笼#
鸡兔同笼
https://www.nowcoder.com/practice/fda725b4d9a14010bb145272cababef1
#include <iostream> using namespace std; int main() { int n; while (cin >> n) { if (n % 2) cout << 0 << " " << 0 << endl; else { int min = 0, max = 0; if (n % 4) min = n / 4 + (n % 4) / 2; //兔和鸡都有 else min = n / 4; max = n / 2;//全是鸡时取最大 cout << min << " " << max << endl; } } return 0; }