比赛 EYOI与SBOI开学欢乐赛4th 评测结果 AAAAAAEEEE
题目名称 烟雾与火焰 最终得分 60
用户昵称 惠惠 运行时间 0.789 s
代码语言 C++ 内存使用 7.22 MiB
提交时间 2022-09-12 19:55:50
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
long long n, p1, p2, p3, ans = 0;
bool boom[1000010] = {0};

void go(long long x)
{
    if(!boom[x] && x <= n)
    {
        ++ans;
        boom[x] = 1;
        go(x + p1);
        go(x + p2);
        go(x + p3);
    }
}

int main()
{
    freopen("burnTokyo.in", "r", stdin);
    freopen("burnTokyo.out", "w", stdout);
    scanf("%lld%lld%lld%lld", &n, &p1, &p2, &p3);
    go(1);
    printf("%lld", ans);
    return 0;
}