JiLi Number HihoCoder - 1432

很有意思,求吉利数,数据范围超级大,但实际上过来题目样例那个数之后就不再变化了,离线计算一个表出来就好了

//leehaoze
#include <iostream>
#include <deque>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <cstdlib>

using namespace std;
const int INF = 1 << 29;
#define INC_SAT(val) (val = ((val)+1 > (val)) ? (val)+1 : (val))
#define ARR_SIZE(a) ( sizeof( (a) ) / sizeof( (a[0]) ) )
#define ULL unsigned long long

int data[] = {1, 199981, 199982, 199983, 199984, 199985, 199986, 199987, 199988, 199989, 199990, 200000, 200001,
              1599981, 1599982, 1599983, 1599984, 1599985, 1599986, 1599987, 1599988, 1599989, 1599990, 2600000,
              2600001, 13199998, 35000000, 35000001, 35199981, 35199982, 35199983, 35199984, 35199985, 35199986,
              35199987, 35199988, 35199989, 35199990, 35200000, 35200001, 117463825, 500000000, 500000001, 500199981,
              500199982, 500199983, 500199984, 500199985, 500199986, 500199987, 500199988, 500199989, 500199990,
              500200000, 500200001, 501599981, 501599982, 501599983, 501599984, 501599985, 501599986, 501599987,
              501599988, 501599989, 501599990, 502600000, 502600001, 513199998, 535000000, 535000001, 535199981,
              535199982, 535199983, 535199984, 535199985, 535199986, 535199987, 535199988, 535199989, 535199990,
              535200000, 535200001, 1111111110};

void Search(char *ipt) {
    int num = atoi(ipt);
    int count = 0;
    while (num >= data[count]) {
        ++count;
    }
    printf("%d %d\n", count, data[count - 1]);
}

int main() {
    char ipt[200];
    while (scanf("%s", ipt) != EOF) {
        if (strlen(ipt) >= 12) {
            printf("83 1111111110\n");
        } else {
            Search(ipt);
        }
    }
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值