#11#12wa,求条
  • 板块P2429 制杖题
  • 楼主zqhbxsgs
  • 当前回复0
  • 已保存回复0
  • 发布时间2025/1/17 10:15
  • 上次更新2025/1/17 14:12:29
查看原帖
#11#12wa,求条
1019317
zqhbxsgs楼主2025/1/17 10:15
#include<bits/stdc++.h>
using namespace std;
const int mod = 376544743;
const int N = 3e2 + 15;
long long ans = 0,a[N],n,m;
long long qz(long long x) {
	long long sum = m / x;
	return sum % 2 == 0?((x + sum * x) * (sum / 2)) % mod:((x + sum * x) * (sum / 2) + x * ((sum + 1) / 2)) % mod;
}
int main() {
	scanf("%lld%lld",&n,&m);
	for(int i = 1; i <= n; i ++) {
		scanf("%lld",&a[i]);
		ans = (ans + qz(a[i])) % mod;
	}
	for(int i = 1; i <= n; i ++) {
		for(int j = i + 1; j <= n; j ++) {
			ans = (ans + mod - qz(a[i] * a[j])) % mod;
		}
	}
	printf("%lld\n",ans);
	return 0;
}
2025/1/17 10:15
加载中...