@root有问题

tctm169 我以逍遥醉人间 2024-11-29 21:27:31 2

#include using namespace std;

int main() { int a; cin >> a;

// 计算最少动物数 
int min_animals = 0; 
int r = a / 4; 
int remaining_feet = a - 4 * r; 
if (remaining_feet % 2 == 0 && remaining_feet >= 2) { 
    min_animals = r + remaining_feet / 2; 
} 

// 计算最多动物数 
int max_animals = a / 2; 

// 输出结果 
cout << min_animals << " " << max_animals << endl; 

return 0; 

}

{{ vote && vote.total.up }}