c++程序运行结果出来之后就停止工作,,怎么回事儿?求解
#include<iostream>#include<cstring>#include<cstdio>#definemax100006usingnamespacestd;...
#include <iostream>#include <cstring>#include <cstdio>#define max 100006using namespace std;int main(){ int a[max]; int n; memset(a,0,sizeof(a)); for(int i = 1; i < max; i++) { int k = i; int sum = i; while(k) { sum += k % 10; k = k / 10; } if(a[sum] == 0 || i < a[sum]) a[sum] = i; } cin >> n; while(n--) { int x; cin >> x; cout << a[x] << endl; } return 0;}
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询