我运用了穷举法,但输出不了正确的数据,代码如下:
#include <iostream>
using namespace std;
int main()
{
int n, a, b{ 0 }, c, d{ 0 }, e{ 0 }, f{ 0 }, g{ 0 };
cin >> n;
for (a = n / 10; d <= a; d++)
for (b = n / 5; e <= b; e++)
for (c = n / 1; f <= c; f++)
if (10 * a + 5 * b + 1 * c == n)
g++;
cout << g;
return 0;
}