Codeforces Round #352 (Div. 2) A
1 second
256 megabytes
standard input
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.
The only line of the input contains a single integer n (1 ≤ n ≤ 1000) — the position of the digit you need to print.
Print the n-th digit of the line.
3
3
11
0
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的更多相关文章
- Codeforces Round #352 (Div. 2) C. Recycling Bottles 暴力+贪心
题目链接: http://codeforces.com/contest/672/problem/C 题意: 公园里有两个人一个垃圾桶和n个瓶子,现在这两个人需要把所有的瓶子扔进垃圾桶,给出人,垃圾桶, ...
- Codeforces Round #352 (Div. 2) D. Robin Hood
题目链接: http://codeforces.com/contest/672/problem/D 题意: 给你一个数组,每次操作,最大数减一,最小数加一,如果最大数减一之后比最小数加一之后要小,则取 ...
- Codeforces Round #352 (Div. 2) D. Robin Hood (二分答案)
题目链接:http://codeforces.com/contest/672/problem/D 有n个人,k个操作,每个人有a[i]个物品,每次操作把最富的人那里拿一个物品给最穷的人,问你最后贫富差 ...
- 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 ...
- Codeforces Round #352 (Div. 1) A. Recycling Bottles 暴力
A. Recycling Bottles 题目连接: http://www.codeforces.com/contest/671/problem/A Description It was recycl ...
- 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 ...
- Codeforces Round #352 (Div. 2) A. Summer Camp 水题
A. Summer Camp 题目连接: http://www.codeforces.com/contest/672/problem/A Description Every year, hundred ...
- Codeforces Round #352 (Div. 2) ABCD
Problems # Name A Summer Camp standard input/output 1 s, 256 MB x3197 B Different is Good ...
- Codeforces Round #352 (Div. 2)
模拟 A - Summer Camp #include <bits/stdc++.h> int a[1100]; int b[100]; int len; void init() { in ...
- 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 ...
随机推荐
- Oracle客户端安装配置
Oracle客户端安装配置.绿色版Oracle客户端配置使用PLSQL 安装Oracle客户端 准备工作,首先下载对应Oracle版本的客户端,这个可以去Oracle官网下载,加压完目录如下: 点击s ...
- nginx 报错: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
执行: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf https://www.cnblogs.com/codingcl ...
- select值改变
改变select的值,然后执行一个方法.可以用chang: $("#select").change(function(){ //要执行的内容 });
- ethereum(以太坊)(一)
从这周开始,开始学习以太坊开发--solidity,开始决定往区块链方向发展,毕竟区块链技术应用广泛.一开始接触solidity开发语言不太习惯,毕竟一直在学习python语法,有很多都不能接受.有难 ...
- js延迟加载的方式有哪些?
共有:defer和async.动态创建DOM方式(用得最多).按需异步载入js defer属性:(页面load后执行) HTML 4.01 为 <script>标签定义了 defer属性. ...
- 【PHP项目】伪静态规则
伪静态规则写法RewriteRule-htaccess详细语法使用 2016年03月30日 16:53:59 阅读数:20340 伪静态实际上是利用php把当前地址解析成另一种方法来访问网站,要学伪静 ...
- linux epoll用法
epoll 是 linux 特有的 I/O 复用函数.它是把用户关心的文件描述符事件放在内核的一个事件列表中,故而,无须像select和poll一样每次调用都重复传入文件描述符或事件集.但是, epo ...
- linux select用法
select 是linux i/o 复用技术之一 man 2 select #include <sys/select.h> /* According to earlier standard ...
- Oozie 实战之 shell
说明:使用 shell action 执行 shell 脚本 hive-select-test.sh 来通过已经配置好的 Hive -f 来执行 HQL 查询脚本文件 select.sql 1.创建脚 ...
- 20145202课后题,2.56&9.16
我做的是2.56题,要求我用多组值来测试show_bytes 9.16 主要是对局部性进行了一些分析. 实验楼里面是空的,我电脑上显示不出来,所以我就做了一些书上的习题. 第十章的所有题目都被学长做过 ...