题目链接:http://codeforces.com/problemset/problem/919/B
AC代码:
#include<cstdio>
using namespace std;
//对全局变量或者对于一个或多个函数来说是全局的变量的时候,要注意上次用完该变量后变量的值,看其是否需要进行初始化。
int main() {
int k, index = 1, stemp, s = 19;
int arr[10005];
int sum = 0;
while (scanf("%d", &k) != EOF) {
while (index <= k) {
stemp = s;
while (stemp != 0) {
sum += stemp % 10;
stemp /= 10;
}
if (sum == 10)
arr[index++] = s;
sum = 0;
s += 9;
}
printf("%d
", arr[k]);
index = 1; //注意
s = 19; //注意
}
return 0;
}