题解 | #鸡兔同笼#
鸡兔同笼
https://www.nowcoder.com/practice/fda725b4d9a14010bb145272cababef1
#include <iostream> using namespace std; int maxNum (int n){ if (n % 2 == 1){ return 0; }else{ return n / 2; } } int minNum (int n){ if (n % 2 == 1){ return 0; } if (n % 4 == 0){ return n / 4; } else{ return n / 4 + 1; } } int main () { int n; while (cin >> n){ cout << minNum(n) << " " << maxNum(n) << endl; } return 0; }