问题遇到的现象和发生背景
用代码块功能插入代码,请勿粘贴截图
#include <stdio.h>
main()
{
int m;
scanf("%d",&m);
for (int i = 0;i <= m; i++)
for (int j = 0; j <= m; j++)
for (int k = 0; k <= m; k++)
{
if (m % 5 == 0 && 5 * k == m)
{
printf("fen5:%d, fen2:0, fen1:0, total:%d\n",k,k);
break;
}
else
{
if (5*k + 2*j + i == m)
{
printf("fen5:%d, fen2:%d, fen1:%d, total:%d\n",k,j,i,k+j+i);
if (m / 5 == k)
break;
}
}
}
}