Submission #19409

# Submission time Handle Problem Language Result Execution time Memory
19409 2016-02-24T11:27:02 Z ekfrl0526 Σ (kriii4_P2) C++14
0 / 100
9 ms 1720 KB
#include<bits/stdc++.h>
using namespace std;
const long long divs = 1000000007;
vector<long long> as;
void initial(long long a) {
	long long ia = a;;
	for (int i = 0; i < 64; i++) {
		if (ia >= divs) ia = ia%divs;
		as.push_back(ia);
		ia *= ia;
	}
}

int main() {
	int n;
	long long ans = 0;
	scanf("%d ", &n);
	while (n--) {
		as.clear();
		long long a, b;
		long long x = divs - 2;
		scanf("%lld %lld", &b, &a);
		initial(b);
		int c = 0;
		long long result = 1;
		while (x > 0) {
			if (x % 2 == 1) {
				result *= as[c];
				result %= divs;
			}
			x /= 2;
			c++;
		}
		result *= a % divs;
		result %= divs;
		ans += result;
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 1720 KB Output isn't correct
2 Halted 0 ms 0 KB -