A. Summer Camp
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Examples
Input
3
Output
3
Input
11
Output
0
Note

In the first sample the digit at position 3 is '3', as both integers 1 and 2 consist on one digit.

In the second sample, the digit at position 11 is '0', it belongs to the integer 10.

题意:"1 2 3 4 5 6 7 8 9 10 11 12 13 14 15...". 连续的数 组成一个字符串(无空格 ,只是便于理解) 请输出n位置上的字符

题解: 可以直接暴力!!! 比赛的时候想多了  分析出  1~99 共189位 最多为一个三位数 分段分析 注意细节

 #include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<queue>
#include<stack>
#define ll __int64
#define pi acos(-1.0)
using namespace std;
int n;
int main()
{
scanf("%d",&n);
if(n<=)
{
cout<<n<<endl;
return ;
}
if(n>&&n<=)
{
n=n-;
int exm=n/;
n--;
n=n%;
if(n==)
cout<<(exm+)%<<endl;
else
cout<<(exm+)/<<endl;
return ;
}
if(n>)
{
n=n-;
int exm=n/;
n=n-;
n=n%;
if(n==)
cout<<(exm+)%<<endl;
if(n==)
cout<<(exm+)/<<endl;
if(n==)
cout<<(exm+-(exm+)/*)/<<endl;
return ;
}
return ;
}

Codeforces Round #352 (Div. 2) A的更多相关文章

  1. Codeforces Round #352 (Div. 2) C. Recycling Bottles 暴力+贪心

    题目链接: http://codeforces.com/contest/672/problem/C 题意: 公园里有两个人一个垃圾桶和n个瓶子,现在这两个人需要把所有的瓶子扔进垃圾桶,给出人,垃圾桶, ...

  2. Codeforces Round #352 (Div. 2) D. Robin Hood

    题目链接: http://codeforces.com/contest/672/problem/D 题意: 给你一个数组,每次操作,最大数减一,最小数加一,如果最大数减一之后比最小数加一之后要小,则取 ...

  3. Codeforces Round #352 (Div. 2) D. Robin Hood (二分答案)

    题目链接:http://codeforces.com/contest/672/problem/D 有n个人,k个操作,每个人有a[i]个物品,每次操作把最富的人那里拿一个物品给最穷的人,问你最后贫富差 ...

  4. Codeforces Round #352 (Div. 1) B. Robin Hood 二分

    B. Robin Hood 题目连接: http://www.codeforces.com/contest/671/problem/B Description We all know the impr ...

  5. Codeforces Round #352 (Div. 1) A. Recycling Bottles 暴力

    A. Recycling Bottles 题目连接: http://www.codeforces.com/contest/671/problem/A Description It was recycl ...

  6. Codeforces Round #352 (Div. 2) B. Different is Good 水题

    B. Different is Good 题目连接: http://www.codeforces.com/contest/672/problem/B Description A wise man to ...

  7. Codeforces Round #352 (Div. 2) A. Summer Camp 水题

    A. Summer Camp 题目连接: http://www.codeforces.com/contest/672/problem/A Description Every year, hundred ...

  8. Codeforces Round #352 (Div. 2) ABCD

    Problems     # Name     A Summer Camp standard input/output 1 s, 256 MB    x3197 B Different is Good ...

  9. Codeforces Round #352 (Div. 2)

    模拟 A - Summer Camp #include <bits/stdc++.h> int a[1100]; int b[100]; int len; void init() { in ...

  10. Codeforces Round #352 (Div. 2) B - Different is Good

    A wise man told Kerem "Different is good" once, so Kerem wants all things in his life to b ...

随机推荐

  1. 基于Xtrabackup恢复单个innodb表

      Preface       We all know that Xtrabackup is a backup tool of percona for innodb or Xtradb.It's us ...

  2. thinkphp5 获取器的

    获取器的作用是在获取数据的字段值后自动进行处理,例如,我们需要对状态值进行转换,可以使用: 1.数据库字段转换. class User extends Model { public function ...

  3. 【CSS】多行溢出显示省略号

    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;//超出三行隐藏 overflow: hidden; ...

  4. ECSHOP快递物流单号查询插件

    本ECSHOP快递物流单号跟踪插件提供国内外近2000家快递物流订单单号查询服务例如申通快递.顺丰快递.圆通快递.EMS快递.汇通快递.宅急送快递.德邦物流.百世快递.汇通快递.中通快递.天天快递等知 ...

  5. composer 使用中国镜像

    本人使用的是windows系统,安装完Composer后,直接打开CMD,执行以下代码: composer config -g repo.packagist composer https://pack ...

  6. Python 中关于文件操作的注意事项

    文件操作 #打开文件 f = open('要打开的文件路径',mode = 'r/w/a', encoding = '文件原来写入时的编码') #操作 data = f.read() #读取 f.wr ...

  7. [bzoj2932][POI1999]树的染色问题

    被百度搜到的题解(论文?)坑了. 写的那玩意好像石乐志... Description 一棵二叉树采用以下规则描述: 1.如果一个节点度数为0,则仅用一个元素“0”来描述它. 2.如果一个节点度数为1, ...

  8. Java中的垃圾回收机制&内存管理&内存泄漏

    1. Java在创建对象时,会自动分配内存,并当该对象引用不存在的时候,释放这块内存. 为什么呢? 因为Java中使用被称为垃圾收集器的技术来监视Java程序的运行,当对象不再使用时,就自动释放对象所 ...

  9. 关于JavaScript设计模式的学习(二)

    第二部分来了,是关于结构型的,同样的,还是在简书中,GitHub上也有代码示例和详细注释 简书:http://www.jianshu.com/p/face1be4b846 github:https:/ ...

  10. SpringMVC 集成 Velocity 模板引擎

    本文通过 maven 项目中集成 1.引入 SpringMVC 与 Velocity 需要的依赖 <!-- SpringMVC --> <dependency> <gro ...