您的位置:首页 > 其它

CodeForces 672A Summer Camp

2016-05-14 20:37 441 查看
思路:水题

#include<bits\stdc++.h>
using namespace std;

int main()
{
string s = "";
int i = 1;
while(s.size()<1000)
{
string s1 = "";
int temp = i;
while(temp)
{
s1+=(temp%10+'0');
temp/=10;
}
reverse(s1.begin(),s1.end());
s+=s1;
i++;
}
int n;
scanf("%d",&n);
printf("%c\n",s[n-1]);

}


Description

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

This is your first year at summer camp, and you are asked to solve the following problem. All integers starting with 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

The only line of the input contains a single integer n (1 ≤ n ≤ 1000) — the position of the digit you need to print.

Output

Print the n-th digit of the line.

Sample Input

Input
3


Output
3


Input
11


Output
0
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: