正文
增加 2 行删除 2 行
6 行未改动789101112131415105 行未改动全部展开1211221231241251261271281296 行未改动朴素的想法是按照题意模拟,复杂度肯定爆了。但是手玩几组数据,可以发现一些规律:造成结果不同的数一定在区间 $[l,r]$ 中,其中 $l,r$ 满足$$l =\underbrace{44\ldots4}_{n \text{ 个 } 4} x \underbrace{000\ldots0}_{m \text{ 个 } 0}\\r =\underbrace{44\ldots4}_{n \text{ 个 } 4} x \underbrace{999\ldots9}_{m \text{ 个 } 9}\\105 行未改动全部展开else if(x>=blk[pos-1].first&&x<=blk[pos-1].second){cout<<pre[pos-1]+x-blk[pos-1].first+1<<endl;}else cout<<pre[pos]<<endl;}return 0;}```6 行未改动789101112131415105 行未改动全部展开1211221231241251261271281296 行未改动朴素的想法是按照题意模拟,复杂度肯定爆了。但是手玩几组数据,可以发现一些规律:造成结果不同的数一定在区间 $[l,r]$ 中,其中 $l,r$ 满足$$l =\underbrace{44\ldots4}_{n \text{ 个 } 4} x \underbrace{000\ldots0}_{m \text{ 个 } 0}\\r =\underbrace{44\ldots4}_{n \text{ 个 } 4} x \underbrace{999\ldots9}_{m \text{ 个 } 9}\\105 行未改动全部展开else if(x>=blk[pos-1].first&&x<=blk[pos-1].second){cout<<pre[pos-1]+x-blk[pos-1].first+1<<endl;}else cout<<pre[pos]<<endl;}return 0;}```