2.
#include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
n = n * 100;
int cock, hen, chicken;
int count = 0;
for (cock = 0; cock <= n; cock ++) { /* !<外层循环控制公鸡数量取值范围0~n */
for (hen = 0; hen <= n; hen ++) { /* !<内层循环控制母鸡数量取值范围0~n */
for (chicken = 0; chicken <= n; chicken ++) {
/* !<内层循环控制小鸡数量取值访问0-n */
if (5 * cock + 2 * hen + chicken == n)
{
count ++;
}
}
}
}
cout << count << endl;
return 0;
}
标签:21,上机,int,2023.5,include,cock
From: https://www.cnblogs.com/fghjktgbijn/p/17421511.html