换分币
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
main()
{
int x, y, z, count = 1;
printf("可能的兑换方法如下:\n");
for (x = 0; x <= 50; x += 10)/*x为1元硬币钱数,其取值为0,10,20,30,40,50*/
for (y = 0; y <= 50 - x; y += 5)
/*y为5角硬币钱数,其取值为0,5,10,15, 20,25,30,35,40,45, 50*/
for (z = 0; z <= 50 - x - y;z++)
/*z为1角硬币钱数,其取值为0,1...50*/
if (x + y + z == 50)
printf(count % 3?"%2d: 10*%d+5*%d+1*%d\t":"%2d:10*%d+5*%d+1*%d\n", count++,x/10, y/5,z);
}