include math int main int argc char const argv int raz 10 chis ost sca

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#include <math.h>
int main (int argc, char const *argv[])
{
int raz[10],i,n,chis,ost;
scanf("%d",&n );
raz[0]=9;
for (i = 1; i < 10;i++)
{
raz[i]=(pow(10,i+1)-pow(10,i))*(i+1)+raz[i-1];
}
i=0;
while(n>raz[i])
{
i++;
}
chis=pow(10,i)+(n-raz[i-1]-1)/(i+1);
ost=(n-raz[i-1]-1)%(i+1);
ost=(int)(chis/pow(10,i))%(10);
printf("%d",ost);
return 0;
}