数字统计

Luogu
IDLGB2082
Time1000ms
Memory128MB
DifficultyP1
循环结构
请统计某个给定范围 $[L,R]$ 的所有整数中,数字 $2$ 出现的次数。 比如给定范围 $[2,22]$,数字 $2$ 在数 $2$ 中出现了 $1$ 次,在数 $12$ 中出现 $1$ 次,在数 $20$ 中出现 $1$ 次,在数 $21$ 中出现 $1$ 次,在数 $22$ 中出现 $2$ 次,所以数字 $2$ 在该范围内一共出现了 $6$ 次。 ## Input 输入共 $1$ 行,为两个正整数 $L$ 和 $R$,之间用一个空格隔开。 ## Output 输出共 $1$ 行,表示数字 $2$ 出现的次数。 [samples] ## Note $1<L,R<10000$。
Samples
Input #1
2 22
Output #1
6
Input #2
2 100
Output #2
20
API Response (JSON)
{
  "problem": {
    "name": "数字统计",
    "description": {
      "content": "请统计某个给定范围 $[L,R]$ 的所有整数中,数字 $2$ 出现的次数。 比如给定范围 $[2,22]$,数字 $2$ 在数 $2$ 中出现了 $1$ 次,在数 $12$ 中出现 $1$ 次,在数 $20$ 中出现 $1$ 次,在数 $21$ 中出现 $1$ 次,在数 $22$ 中出现 $2$ 次,所以数字 $2$ 在该范围内一共出现了 $6$ 次。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB2082"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "请统计某个给定范围 $[L,R]$ 的所有整数中,数字 $2$ 出现的次数。\n\n比如给定范围 $[2,22]$,数字 $2$ 在数 $2$ 中出现了 $1$ 次,在数 $12$ 中出现 $1$ 次,在数 $20$ 中出现 $1$ 次,在数 $21$ 中出现 $1$ 次,在数 $22$ 中出现 $2$ 次,所以数字 $2$ 在该范围内一共出现了 $6$ 次。\n\n## Input\n\n输入共 $1$ 行...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments