求助!!要疯了!!一直是50
查看原帖
求助!!要疯了!!一直是50
520544
Phrvth楼主2023/1/3 22:11
#include<bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 5e5 + 7, mod = 1e12 + 7;

int T, n, l;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cin >> T;
	while (T--) {
		cin >> n >> l;
		if (n == 1) cout << 0 << endl;
		else cout << ((l / 2 * (l - l / 2)) % mod * ((int)pow(2, (int)log2(n) + 1) - 1)) % mod << endl;
	}
	return 0;
}

怀疑是取模的问题??

如果解决了能不能讲讲?

2023/1/3 22:11
加载中...