硬币问题

Luogu
IDLGB3635
Time1000ms
Memory128MB
DifficultyP2
动态规划 DP
今有面值为 1、5、11 元的硬币各无限枚。 想要凑出 $n$ 元,问需要的最少硬币数量。 ## Input 仅一行,一个正整数 $n$。 ## Output 仅一行,一个正整数,表示需要的硬币个数。 [samples] ## Note #### 样例解释 对于样例数据 1,最佳方案是 $15=5+5+5$,使用到 3 枚硬币。 对于样例数据 2,最佳方案是 $12=11 + 1$,使用到 2 枚硬币。 #### 数据规模与约定 对于 $100\%$ 的数据,保证 $n\leq 10^6$。
Samples
Input #1
15
Output #1
3
Input #2
12
Output #2
2
API Response (JSON)
{
  "problem": {
    "name": "硬币问题",
    "description": {
      "content": "今有面值为 1、5、11 元的硬币各无限枚。 想要凑出 $n$ 元,问需要的最少硬币数量。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 131072
    },
    "difficulty": {
      "LuoguStyle": "P2"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGB3635"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "今有面值为 1、5、11 元的硬币各无限枚。\n\n想要凑出 $n$ 元,问需要的最少硬币数量。\n\n## Input\n\n仅一行,一个正整数 $n$。\n\n## Output\n\n仅一行,一个正整数,表示需要的硬币个数。\n\n[samples]\n\n## Note\n\n#### 样例解释\n\n对于样例数据 1,最佳方案是 $15=5+5+5$,使用到 3 枚硬币。\n\n对于样例数据 2,最佳方案是 $12=11 + ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments