답안 #19313

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
19313 2016-02-24T09:26:42 Z imsifile Σ (kriii4_P2) C++
100 / 100
8 ms 1084 KB
#include<stdio.h>
#define mod 1000000007

typedef long long lld;
lld a, b, sum;

lld exp(lld a, lld b){
	if(b==0)return 1;
	lld k=exp(a, b/2);
	k=(k*k)%mod;
	if(b%2)k=(k*a)%mod;
	return k;
}

int main(){
	int n, i;
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%lld%lld", &a, &b), a=exp(a,mod-2);
		sum = (sum + a*b)%mod;
	}
	printf("%lld", sum);
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 6 ms 1084 KB Output is correct
3 Correct 8 ms 1084 KB Output is correct
4 Correct 6 ms 1084 KB Output is correct
5 Correct 8 ms 1084 KB Output is correct
6 Correct 7 ms 1084 KB Output is correct
7 Correct 7 ms 1084 KB Output is correct
8 Correct 8 ms 1084 KB Output is correct
9 Correct 8 ms 1084 KB Output is correct
10 Correct 8 ms 1084 KB Output is correct
11 Correct 2 ms 1084 KB Output is correct
12 Correct 0 ms 1084 KB Output is correct
13 Correct 0 ms 1084 KB Output is correct
14 Correct 5 ms 1084 KB Output is correct
15 Correct 7 ms 1084 KB Output is correct
16 Correct 8 ms 1084 KB Output is correct
17 Correct 5 ms 1084 KB Output is correct
18 Correct 0 ms 1084 KB Output is correct
19 Correct 7 ms 1084 KB Output is correct
20 Correct 2 ms 1084 KB Output is correct