Submission #19326

# Submission time Handle Problem Language Result Execution time Memory
19326 2016-02-24T09:45:18 Z xdoju Σ (kriii4_P2) C++14
0 / 100
5 ms 1120 KB
#include <cstdio>
using namespace std;

const long long MOD = 1000000007ll;
int m;
int face[10000];

long modpow(long long r, long long n) {
	long long ret = 1;
	while (n > 0) {
		if (n % 2 > 0) {
			ret = (ret * r) % MOD;
		}
		r = (r * r) % MOD;
		n /= 2;
	}
	return ret;
}

long long modinv(int n) {
	return modpow(n, MOD - 2);
}


void proc() {
	int m;
	scanf("%d", &m);
	long long res = 1;
	for (int i = 0; i < m; ++i) {
		int face, sum;
		scanf("%d %d", &face, &sum);
		res = (res * sum) % MOD;
		res = (res * modinv(face)) % MOD;
	}
	printf("%lld", res);
}

int main() {
	proc();
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 1120 KB Output isn't correct
2 Halted 0 ms 0 KB -