题解
1.abcdef=1a*+ab*abc+abc*abcd+...+abcde*abcedf
code
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll f[13]={0},sum[13]={0};
void solve()
{
ll now;
cin>>now;
ll pre=10;
ll pos=lower_bound(sum+1,sum+13,now)-sum-1;
ll ans=0;
ll top=1;
now-=sum[pos];
for(int i=pos;i>=0;i--)
{
ll tem=f[i],cnt=0;
while((cnt+1)*tem<(now))top++,cnt++;
now-=cnt*tem;
if(top>=pre) top++;
ans=ans*10+top;
pre=top;
top=0;
}
cout<<ans<<endl;
}
int main()
{
f[0]=1;f[1]=9;sum[1]=9;
for(int i=2;i<=12;i++)f[i]=f[i-1]*9LL,sum[i]=sum[i-1]+f[i];
ll t;
cin>>t;
while(t--) solve();
return 0;
}
标签:pre,ll,top,ARC173A,Number,pos,now,sum,Neq
From: https://www.cnblogs.com/pure4knowledge/p/18090415