题解 | 鸡兔同笼
鸡兔同笼
https://www.nowcoder.com/practice/fda725b4d9a14010bb145272cababef1
#include <iostream>
using namespace std;
int main() {
int n;
int max, min;
while (cin >> n) {
if (n % 2) {
cout << "0 0" << endl;
continue;
}
int t = n;
min = 0;
max = t / 2;
while (t) {
if (t >= 4) {
min++;
t -= 4;
} else {
min++;
t -= 2;
}
}
cout << min << " " << max << endl;
}
}
// 64 位输出请用 printf("%lld")
洒洒水啦~