this is the problem:
alex has written a programm that prints numbers from 1 to 5000 in deifferent lines but unfortunately his \t has a problem and the programm has producted a huge number "12345678910111213141516..."
now he want know the k'th number of this huge number.
for example input 10 and output 1
#include<iostream>
using namespace std;
int main()
{
int k;
double x;
cin>>k;
if(k<10)
{
cout<<k;
}
if(k>9&&k<190)
{
x=(k-9)/2.0;
if(x-int(x)!=0)
{
x=int (x)+1;
}
x=x+9;
if(k%2==0)
cout<<int (x)/10;
else
cout<<int (x)%10;
}
if(k>189&&k<2890)
{
x=(k-189)/3.0;
if(x-int (x)!=0)
{
x=int (x)+1;
}
x+=99;
if(k%3==0)
{
cout<<int (x)%10;
}
else
if(k%3==1)
{
cout<<int (x)/100;
}
else
if(k%3==2)
{
cout<<(int (x)/10)%10;
}
}
if(k>2889)
{
x=(k-2889)/4.0;
if(x-int (x)!=0)
{
x=int (x)+1;
}
x+=999;
if(k%4==2)
{
cout<<int (x)/1000;
}
else
if(k%4==3)
{
cout<<(int(x)/100)%10;
}
else
if(k%4==0)
{
cout<<(int(x)/10)%10;
}
else
if(k%4==1)
{
cout<<int(x)%10;
}
}
return 0;
}
Anonymous
Shiva
Pavel
klimi
浩
\Device\NUL
Suka
Roman
Kate
Kate
Dennastus
Emmanuel
Amonov
Shao