#include<stdio.h>
int main()
{
int one,tow,five,num=1;
for (one = 1; one < num*10; one++)
{
for (tow = 1; tow < num*10 / 2; tow++)
{
for (five = 1; five < num*10 / 5; five++)
{
if (one + tow * 2 + five * 5 == num*10)
{
printf("可以用%d个1角+%d个2角+%d个5角得到%d元\n",one,tow,five,num);
//goto out;
}
}
}
}
//out:
return 0;
}
时间: 2024-10-12 20:09:36