第一题答案:
# include <stdio.h>
# include <math.h>
static __int64 a[] = {1,11,192,2893,38894,488895};
static __int64 b[] = {45,9000,1386450,188019000,23750235000};
static __int64 c[] = {1,10,100,1000,10000,100000};
static __int64 d[] = {9,180,2700,36000,450000,5400000};
int main()
{
int t, i;
__int64 tmp, an, n;
scanf("%d",&t);
while(t--)
{
scanf("%I64d",&tmp);
i = 0;
while(tmp > b[i])
tmp -= b[i++];
an = a[i];
while(tmp > an)
{
tmp -= an;
an += i+1;
}
i = 0;
while(tmp > d[i])
tmp -= d[i++];
n = (tmp-1) / (i+1);
tmp -= n*(i+1);
n += c[i];
n /= c[i+1-tmp];
printf("%I64d\n",n%10);
}
return 1;
}