题解 | #鸡兔同笼#
鸡兔同笼
https://www.nowcoder.com/practice/fda725b4d9a14010bb145272cababef1
#include <iostream> #include<cmath> using namespace std; int main() { int n; while (cin >> n) { // 注意 while 处理多个 case if(n%2!=0){ //n为奇数 cout<<0<<" "<<0<<endl; }else{ //n为偶数 if(n%4==0){ //可被4整除 cout<<n/4<<" "<<n/2<<endl; }else{ //不可被4整除 cout<<(n/4)+1<<" "<<n/2<<endl; } } } } // 64 位输出请用 printf("%lld")