Submission #19299

# Submission time Handle Problem Language Result Execution time Memory
19299 2016-02-24T09:07:08 Z ainta Σ (kriii4_P2) C++
0 / 100
0 ms 1084 KB
#include<stdio.h>
#include<algorithm>
using namespace std;
int n;
long long Mod = 1000000007, A, B, C, D, TA, TB;
long long Inv(long long a){
    long long b = Mod - 2, r = 1;
    while(b){
        if(b%2)r=r*a%Mod;
        a=a*a%Mod;b/=2;
    }
    return r;
}
int main(){
    int i;
    scanf("%d",&n);
    A = 1, B = 0;
    for(i=1;i<=n;i++){
        scanf("%lld%lld",&C,&D);
        TB = B*C+A*D;
        TA = A*C;
        TA%=Mod, TB%=Mod;
    }
    printf("%lld\n",TB*Inv(TA)%Mod);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -