0
点赞
收藏
分享

微信扫一扫

codeforces 672A Summer Camp


A. Summer Camp



time limit per test



memory limit per test



input



output


Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems.

1 are written in one line. The prefix of these line is "123456789101112131415...". Your task is to print the n-th digit of this string (digits are numbered starting with 1.


Input



n (1 ≤ n ≤ 1000) — the position of the digit you need to print.


Output



n-th digit of the line.


Examples



input



3



output



3



input



11



output



0


Note



3 is '3', as both integers 1 and 2

11 is '0', it belongs to the integer 10.


#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
template<typename T> string toString(const T& t){
ostringstream oss; //创建一个格式化输出流
oss<<t; //把值传递如流中
return oss.str();
}
int main()
{
string str;
int i=1;
string s;
while(1)
{
s=toString(i);
str=str+s;
if(str.length()>=1000)
break;
i++;
}
int n;
scanf("%d",&n);
cout<<str[n-1]<<endl;
return 0;
}



举报

相关推荐

0 条评论