暴力杯
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef pair<int, int> PII;
const int N = 1000010;
int n;
PII a[N];
int get(int i)
{
int res = 0;
while(i)
{
res += i % 10;
i /= 10;
}
return res;
}
int main()
{
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; i ++) a[i].first = get(i), a[i].second = i;
sort(a + 1, a + n + 1);
cout << a[m].second << endl;
return 0;
}
超时
我ac了,没超时啊