这是我做的,试过了,没问题,你看看!
#include <stdio.h>
main()
{
int x,y,z,count=0;
for(x=1;x<20;x++)
{
for(y=1;y<32;y++)
{
z=100-x-y;
if((z%3)==0&&5*x+3*y+z/3==100)
{
printf("x=%d,y=%d,z=%d\n",x,y,z);
count++;
}
}
}
printf("There are %d methords in total.",count);
getch();
}
