int SpSum(int v)
{
int s = 0;
if(v <= 0)
throw ...
while(v > 0)
{
s += mod(v, 10);
v = v%10;
}
return v;
}
void EnumNum(int min, int max, int x)
{
if(min <=0 || max <= 0 || min >= max)
throw ...
for(int i = min; i <= max; i++)
if(SpSum(i) == x)
cout << i << endl;
}
试试看对不对
x=int(input())
k=0
for i in range(100,1000):
if(x==i//100+i%10+i%100//10):
print(i,' ')
k+=1
if(k==4):
k=0
print()