85分!三个点都是0!大佬求救!
查看原帖
85分!三个点都是0!大佬求救!
1364428
I_am_sb2楼主2025/1/30 19:43
#include <bits/stdc++.h>
using namespace std;
int x, y, z, n, m, cnt = 0;

int main() {
	cin >> x >> y >> z >> n >> m;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			int s = (n - i * x - j * y) * z;
			if (i + j + s == m && s >= 0 && s <= n) {
//				cout << i << " " << j << " " << s << endl;
				cnt++;
			}
		}
	}
	cout << cnt;
	return 0;
}
2025/1/30 19:43
加载中...