# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20093 |
2016-02-25T12:13:18 Z |
jihoon |
능력 (kriii4_S) |
C++ |
|
0 ms |
1160 KB |
#include<cstdio>
#define je 1000000007
long long gop(long long x,long long y){
x%=je;y%=je;
x*=y;x%=je;
return x;
}
long long hap(long long x,long long y){
x%=je;y%=je;
x+=y;x%=je;
return x;
}
long long div(long long x,long long y){
x%=je;y%=je;
int left=je-2;
long long gopp=y,ret=1;
while(left){
if(left&1){
ret=gop(ret,gopp);
}
gopp=gop(gopp,gopp);
left >>= 1;
}
ret=gop(ret,x);
return ret;
}
int n;
long long abil[5001][2];
long long can,sum=0,ans=0;
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d %d",&abil[i][0],&abil[i][1]);
sum=hap(sum,abil[i][0]);
}
can=1;
for(int i=0;i<n;i++){
can=gop(can,1000000000-abil[i][0]);
can=div(can,1000000000);
}
can=(je+1-can)%je;
for(int i=0;i<n;i++){
ans=hap(ans,gop(can,gop(abil[i][1],div(abil[i][0],sum))));
}
printf("%lld\n",ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1160 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |