[CCC 2022 S1] Good Fours and Good Fives

Luogu
IDLGP8395
Time1000ms
Memory128MB
DifficultyP2
动态规划 DP2022枚举CCC(加拿大)
$\rm Finn$ 非常喜欢 $4$ 和 $5$,他认为所有的数都可以用 $4$ 和 $5$ 进行相加得出。 例: $14=5+5+4$ $20=4+4+4+4+4$ 或 $20=5+5+5+5$ $40=4+4+4+4+4+4+4+4+4+4$ 或 $40=4+4+4+4+4+5+5+5+5$ 或 $40=5+5+5+5+5+5+5+5$ 当然,$4$ 和 $5$ 的顺序并不重要,重要的是他们的个数。 给你一个正整数 $n$,问有多少种方法可以用 $4$ 和 $5$ 拼凑成 $n$。 ## Input 一行,一个整数 $n$,表示要被拼凑的数。 ## Output 一行,表示方法的数量。如果这个数不能被拼凑,请输出 $0$。 [samples] ## Note 对于 $20\%$ 的数据:$1\le n\le 10$ 对于另外 $15\%$ 的数据:$1\le n\le10^5$ 并且保证 $n\equiv0$ $\pmod 4$ 对于另外 $15\%$ 的数据:$1\le n\le10^5$ 并且保证 $n\equiv0$ $\pmod 5$ 对于 $100\%$ 的数据:$1\le n\le 10^6$
Samples
Input #1
14
Output #1
1
Input #2
40
Output #2
3
Input #3
6
Output #3
0
API Response (JSON)
{
  "problem": {
    "name": "[CCC 2022 S1]  Good Fours and Good Fives",
    "description": {
      "content": "$\\rm Finn$ 非常喜欢 $4$ 和 $5$,他认为所有的数都可以用 $4$ 和 $5$ 进行相加得出。 例: $14=5+5+4$ $20=4+4+4+4+4$ 或 $20=5+5+5+5$ $40=4+4+4+4+4+4+4+4+4+4$ 或 $40=4+4+4+4+4+5+5+5+5$ 或 $40=5+5+5+5+5+5+5+5$ 当然,$4$ 和 $5$ 的顺序并不重要,重",
      "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": "LGP8395"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "$\\rm Finn$ 非常喜欢 $4$ 和 $5$,他认为所有的数都可以用 $4$ 和 $5$ 进行相加得出。\n\n例:\n\n$14=5+5+4$\n\n$20=4+4+4+4+4$ 或 $20=5+5+5+5$\n\n$40=4+4+4+4+4+4+4+4+4+4$ 或 $40=4+4+4+4+4+5+5+5+5$ 或 $40=5+5+5+5+5+5+5+5$\n\n当然,$4$ 和 $5$ 的顺序并不重要,重...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments