# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19395 | camille | Σ (kriii4_P2) | C++98 | 29 ms | 1716 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
typedef long long lld;
lld a,x,mod=1e9+7,t,ret;
lld foo(lld idx){
if(idx==1) return a;
lld k = foo(idx/2)%mod;
if(idx%2) return (((k*k)%mod)*a)%mod;
return (k*k)%mod;
}
int main(){
cin>>t;
while(t--){
cin>>a>>x;
a%=mod;
ret+=(x*foo(mod-2))%mod;
ret%=mod;
}
cout<<ret<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |