语言月赛红题求调
查看原帖
语言月赛红题求调
226167
呆呆的她啊楼主2024/1/24 00:01
#include <iostream>
#include <math.h>
using namespace std;
long long ans =0;
int main() {
	int a, b, c, d, e, f, g, p, x, xx, y, yy;
	cin >> a >> b >> c >> d >> e >> f >> g ;
	cin>> p >> x >> xx >> y >> yy;
	for (int i = x; i <= xx; i++) {
		for (int j = y; j <= yy; j++) {
			long long g1;
			long long g2;
			long long g3;
			g1 = ((a * i * i * i) % p + (b * j * j * j) % p) % p;
			g2 = ((c * j * i * i) % p + (d * i * j * j) % p) % p;
			g3 = ((e * i * j) % p + (f * i) % p + (g * j) % p) % p;
			long long g4= (g1 + g2 + g3) % p;
			ans = max(g4, ans);
		}
	}
	cout << ans % p;
	return 0;
}
2024/1/24 00:01
加载中...