A. Summer Camp

题目连接:

http://www.codeforces.com/contest/672/problem/A

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

3

Sample Output

3

题意

这个串是1234567891011121314,这样一直下去的

现在给你n,让你输出第n个字符是啥

题解:

数据范围才1000,直接暴力模拟就好了……

代码

#include<bits/stdc++.h>
using namespace std;
string s,s1;
int add=1;
int main()
{while(s.size()<1000){s1="";int tmp=add;while(tmp){s1+=(tmp%10+'0');tmp/=10;}reverse(s1.begin(),s1.end());s+=s1;add++;}int n;scanf("%d",&n);cout<<s[n-1]<<endl;
}

Codeforces Round #352 (Div. 2) A. Summer Camp 水题相关推荐

  1. Codeforces Codeforces Round #319 (Div. 2) A. Multiplication Table 水题

    A. Multiplication Table Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/57 ...

  2. Codeforces Round #277 (Div. 2) A. Calculating Function 水题

    A. Calculating Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/4 ...

  3. Codeforces Round #360 (Div. 2) C. NP-Hard Problem 水题

    C. NP-Hard Problem 题目连接: http://www.codeforces.com/contest/688/problem/C Description Recently, Pari ...

  4. Codeforces Round #322 (Div. 2) B. Luxurious Houses 水题

    B. Luxurious Houses Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/pr ...

  5. Codeforces Round #701 (Div. 2) A ~ F ,6题全,超高质量良心题解【每日亿题】2021/2/13

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Add and Divide B - Replace and Keep Sorted C ...

  6. Codeforces Round #700 (Div. 2) A ~ E ,6题全,超高质量良心题解【每日亿题】2021/2/8

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Yet Another String Game B - The Great Hero C ...

  7. Codeforces Beta Round #14 (Div. 2) B. Young Photographer 水题

    B. Young Photographer 题目连接: http://codeforces.com/contest/14/problem/B Description Among other thing ...

  8. Codeforces Round #374 (Div. 2) A , B , C 水,水,拓扑dp

    A. One-dimensional Japanese Crossword time limit per test 1 second memory limit per test 256 megabyt ...

  9. Codeforces Round #518 (Div. 2): F. Knights(神题)

    题意: 一个无限大的棋盘,初始往这个棋盘中放n个骑士(骑士走日字,和马一样),之后如果存在一个点可以被4个骑士一步到达,那么就往这个格子上再放一个马,并且无限继续下去,直到不存在任意一个点可以被4个骑 ...

最新文章

  1. Python基础学习笔记--字符串、列表
  2. 没有场景,不做单点技术输出,360数科如何做金融科技的最佳实践?
  3. 系统间通信——dubbo
  4. bootstrap之div居中
  5. python求10的所有因数_python怎么求因数
  6. JAVA常见算法题(十三)
  7. 扎克伯格All in元宇宙,公司更名Meta,「脸」不要了
  8. 什么是nginx负载均衡高可用
  9. 【简便代码】1082 射击比赛 (20分)_17行代码AC
  10. php+ajax+打开新页面跳转,ajax怎样跳转到新的jsp页面(附代码)
  11. python 关联矩阵_创建关联矩阵
  12. 华为nova 2 Plus魔镜版语音助手逗趣玩不停
  13. poi导出百万数据到excel,只在瞬息之间
  14. 蒙特卡洛(Monte Carlo)方法的理解
  15. OSChina 周日乱弹 —— 每天叫醒我的是Bug
  16. 硬件测试转软件研发,硬件测试可以考虑的发展方向
  17. php 应用宝支付,手游渠道应用宝接入总结
  18. 考早了!华为认证推出“一试双证”,IE直接补贴3000元
  19. 模型数据处理之关键属性提取——SuperMap iDesktop
  20. (更新时间)2021年6月4日 商城高并发秒杀系统(.NET Core版) 30-lua文件封装加载和执行

热门文章

  1. 代码片段管理器——SnippetsLab
  2. mysql,mairadb启动脚本
  3. MySQL升级教程(CentOS)
  4. springMVC入门配置及helloworld实例
  5. 快速更换一个国内的yum源
  6. 网络工作室暑假后第二次培训资料(SQLServer存储过程和ADO.NET访问存储过程)整理(一)...
  7. 3、深入理解计算机系统笔记:程序的机器级表示
  8. Cisco ××× 完全配置指南-连载-IOS ×××阶段2连接详解
  9. 如何打造基于比特币现金(BCH)的消费需求
  10. Abra宣布对BCH的原生支持