[GESP202406 二级] 计数

Luogu
IDLGB4007
Time1000ms
Memory512MB
DifficultyP1
2024循环结构GESP
小杨认为自己的幸运数是正整数 $k$(注:保证 $1 \le k\le 9$)。小杨想知道,对于从 $1$ 到 $n$ 的所有正整数中, $k$ 出现了多少次。 ## Input 第一行包含一个正整数 $n$。 第二行包含一个正整数 $k$。 ## Output 输出从 $1$ 到 $n$ 的所有正整数中, $k$ 出现的次数。 [samples] ## Background 对应的选择、判断题:<https://ti.luogu.com.cn/problemset/1150> ## Note 从 $1$ 到 $25$ 中,$2$ 出现的正整数有 $2,12,20,21,22,23,24,25$ ,一共出现了 $9$ 次。 对于全部数据,保证有 $1 \le n\le 1000,1 \le k\le 9$。
Samples
Input #1
25
2
Output #1
9
API Response (JSON)
{
  "problem": {
    "name": "[GESP202406 二级] 计数",
    "description": {
      "content": "小杨认为自己的幸运数是正整数 $k$(注:保证 $1 \\le k\\le 9$)。小杨想知道,对于从 $1$ 到 $n$ 的所有正整数中, $k$ 出现了多少次。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P1"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB4007"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "小杨认为自己的幸运数是正整数 $k$(注:保证 $1 \\le k\\le 9$)。小杨想知道,对于从 $1$ 到 $n$ 的所有正整数中, $k$ 出现了多少次。\n\n## Input\n\n第一行包含一个正整数 $n$。\n\n第二行包含一个正整数 $k$。\n\n## Output\n\n输出从 $1$ 到 $n$ 的所有正整数中, $k$ 出现的次数。\n\n[samples]\n\n## Background\n\n对应...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments