#include <stdio.h>
int main()
{
int n, nn, sum, one, count;
for (count = sum = n = 0; n < 0x7FFFffff; n++) {
// nに含まれる1の個数を求める
nn = n;
for (one = 0; nn > 0; nn /= 10) {
if (nn % 10 == 1) {
one++;
}
}
// 累計
sum += one;
if (n > 0 && n == sum) {
count++;
if (count == 2) {
return 0;
}
}
}
printf("0-%dの間では見つからなかった\n", 0x7FFFffff); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpCnsKICAgIGludCBuLCBubiwgc3VtLCBvbmUsIGNvdW50OwoKICAgIGZvciAoY291bnQgPSBzdW0gPSBuID0gMDsgbiA8IDB4N0ZGRmZmZmY7IG4rKykgewogICAgICAgIC8vIG7jgavlkKvjgb7jgozjgosx44Gu5YCL5pWw44KS5rGC44KB44KLCiAgICAgICAgbm4gPSBuOwogICAgICAgIGZvciAob25lID0gMDsgbm4gPiAwOyBubiAvPSAxMCkgewogICAgICAgICAgICBpZiAobm4gJSAxMCA9PSAxKSB7CiAgICAgICAgICAgICAgICBvbmUrKzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAvLyDntK/oqIgKICAgICAgICBzdW0gKz0gb25lOwogICAgICAgIGlmIChuID4gMCAmJiBuID09IHN1bSkgewogICAgICAgICAgICBjb3VudCsrOwogICAgICAgICAgICBpZiAoY291bnQgPT0gMikgewogICAgICAgICAgICAgICAgcHJpbnRmKCIlZFxuIiwgbik7CiAgICAgICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHByaW50ZigiMC0lZOOBrumWk+OBp+OBr+imi+OBpOOBi+OCieOBquOBi+OBo+OBn1xuIiwgMHg3RkZGZmZmZik7CiAgICByZXR1cm4gMDsKfQo=