Blue Bridge Cup python group - house number production

Blue Bridge Cup python group - house number production

Topic description

This question is a fill-in-the-blank question. After calculating the result, use the output statement in the code to output the filled result.

Xiaolan wants to make house numbers for the residents of a street.

There are 20202020 residents in this street, with house numbers from 11 to 20202020.

The method of Xiaolan to make the house number is to first make the number characters from 00 to 99, and finally paste the characters on the house number according to the needs. 11 characters 00, 22 characters 11, 11 characters 77 are required.

How many characters 2 are needed in total to make all the house numbers from 11 to 20202020?

Running limit
Maximum running time: 1s
Maximum running memory: 128M

import os
import sys
b=0
for i in range (1,2021):
  a=str(i).count('2')
  b+=a
print(b)

insert image description here
Thank you for your support. Your one-click three-connection is the biggest driving force for Ganggang students!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324322303&siteId=291194637