Codeforces Round #352 (Div. 2) 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 水题相关推荐
- 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 ...
- Codeforces Round #277 (Div. 2) A. Calculating Function 水题
A. Calculating Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/4 ...
- Codeforces Round #360 (Div. 2) C. NP-Hard Problem 水题
C. NP-Hard Problem 题目连接: http://www.codeforces.com/contest/688/problem/C Description Recently, Pari ...
- 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 ...
- Codeforces Round #701 (Div. 2) A ~ F ,6题全,超高质量良心题解【每日亿题】2021/2/13
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Add and Divide B - Replace and Keep Sorted C ...
- Codeforces Round #700 (Div. 2) A ~ E ,6题全,超高质量良心题解【每日亿题】2021/2/8
整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Yet Another String Game B - The Great Hero C ...
- Codeforces Beta Round #14 (Div. 2) B. Young Photographer 水题
B. Young Photographer 题目连接: http://codeforces.com/contest/14/problem/B Description Among other thing ...
- 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 ...
- Codeforces Round #518 (Div. 2): F. Knights(神题)
题意: 一个无限大的棋盘,初始往这个棋盘中放n个骑士(骑士走日字,和马一样),之后如果存在一个点可以被4个骑士一步到达,那么就往这个格子上再放一个马,并且无限继续下去,直到不存在任意一个点可以被4个骑 ...
最新文章
- Python基础学习笔记--字符串、列表
- 没有场景,不做单点技术输出,360数科如何做金融科技的最佳实践?
- 系统间通信——dubbo
- bootstrap之div居中
- python求10的所有因数_python怎么求因数
- JAVA常见算法题(十三)
- 扎克伯格All in元宇宙,公司更名Meta,「脸」不要了
- 什么是nginx负载均衡高可用
- 【简便代码】1082 射击比赛 (20分)_17行代码AC
- php+ajax+打开新页面跳转,ajax怎样跳转到新的jsp页面(附代码)
- python 关联矩阵_创建关联矩阵
- 华为nova 2 Plus魔镜版语音助手逗趣玩不停
- poi导出百万数据到excel,只在瞬息之间
- 蒙特卡洛(Monte Carlo)方法的理解
- OSChina 周日乱弹 —— 每天叫醒我的是Bug
- 硬件测试转软件研发,硬件测试可以考虑的发展方向
- php 应用宝支付,手游渠道应用宝接入总结
- 考早了!华为认证推出“一试双证”,IE直接补贴3000元
- 模型数据处理之关键属性提取——SuperMap iDesktop
- (更新时间)2021年6月4日 商城高并发秒杀系统(.NET Core版) 30-lua文件封装加载和执行