zoukankan      html  css  js  c++  java
  • Codeforces Round #352 (Div. 2) A Summer Camp

    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
    不会模拟,只能打表
    #include<stdio.h>
    char s[1005]={"1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693"};
    int main()
    {
        int n;
        scanf("%d",&n);
        printf("%c
    ",s[n-1]);
    }
  • 相关阅读:
    新博客
    【Gym-100712 #H】Bridges
    【CodeForces817F】MEX Queries
    【POJ1734】Sightseeing trip
    【Aizu2968】Non-trivial Common Divisor
    【Gym-101473 #I】Patches
    【POJ2228】Naptime
    【CodeForces219D】Choosing Capital for Treeland
    【URAL1018】Binary Apple Tree
    深入探索C++对象模型(五)
  • 原文地址:https://www.cnblogs.com/wangmenghan/p/5491780.html
Copyright © 2011-2022 走看看