比赛 EYOI与SBOI开学欢乐赛4th 评测结果 AAAAAAEEEE
题目名称 烟雾与火焰 最终得分 60
用户昵称 Lfc_HeSn 运行时间 1.023 s
代码语言 C++ 内存使用 6.11 MiB
提交时间 2022-09-12 20:29:06
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n, a, b, c, ans;
bool f[10000010];
signed main() {
	freopen("burnTokyo.in", "r", stdin);
	freopen("burnTokyo.out", "w", stdout);
	cin >> n >> a >> b >> c;
	f[1] = 1;
	for(int i = 1; i <= n; i ++) {
		if(f[i]) {
			ans ++;
			int x1 = i + a, x2 = i + b, x3 = i + c;
			if(x1 <= n) {
				f[x1] = 1;
			}
			if(x2 <= n) {
				f[x2] = 1;
			}
			if(x3 <= n) {
				f[x3] = 1;
			}
		}
	}
	cout << ans << endl;
    return 0;
}