Submission #19826

# Submission time Handle Problem Language Result Execution time Memory
19826 2016-02-25T06:02:46 Z Namnamseo 순열 (kriii4_T) C++14
100 / 100
1125 ms 16708 KB
#include<cstdio>
long long mans,c,mul[1000003],fac[1000003],a,b,i,j,s=1,ans,X=1e9+7;
long long pow(long long aa,long long bb){
    if(bb==0) return 1;
    long long ret=pow(aa,bb/2);
    ret=(ret*ret)%X;
    if(bb&1) ret=(ret*aa)%X;
    return ret;
}

main()
{
    scanf("%lld%lld",&a,&b);
    if(b>=a)
    {
        printf("0");return 0;
    }
    fac[0]=1;
    for(i=1;i<=a+1;i++)fac[i]=fac[i-1]*i%X;
    for(i=b+1;i<=a;i++)
    {
        mans+=fac[a+1]*(a-i+1)%X*pow(i+1,X-2)%X;
        mans%=X;
    }
    printf("%lld",mans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 16708 KB Output is correct
2 Correct 0 ms 16708 KB Output is correct
3 Correct 0 ms 16708 KB Output is correct
4 Correct 0 ms 16708 KB Output is correct
5 Correct 0 ms 16708 KB Output is correct
6 Correct 0 ms 16708 KB Output is correct
7 Correct 0 ms 16708 KB Output is correct
8 Correct 0 ms 16708 KB Output is correct
9 Correct 0 ms 16708 KB Output is correct
10 Correct 0 ms 16708 KB Output is correct
11 Correct 0 ms 16708 KB Output is correct
12 Correct 0 ms 16708 KB Output is correct
13 Correct 0 ms 16708 KB Output is correct
14 Correct 0 ms 16708 KB Output is correct
15 Correct 0 ms 16708 KB Output is correct
16 Correct 0 ms 16708 KB Output is correct
17 Correct 0 ms 16708 KB Output is correct
18 Correct 0 ms 16708 KB Output is correct
19 Correct 0 ms 16708 KB Output is correct
20 Correct 0 ms 16708 KB Output is correct
21 Correct 0 ms 16708 KB Output is correct
22 Correct 0 ms 16708 KB Output is correct
23 Correct 0 ms 16708 KB Output is correct
24 Correct 1 ms 16708 KB Output is correct
25 Correct 0 ms 16708 KB Output is correct
26 Correct 0 ms 16708 KB Output is correct
27 Correct 0 ms 16708 KB Output is correct
28 Correct 1 ms 16708 KB Output is correct
29 Correct 0 ms 16708 KB Output is correct
30 Correct 0 ms 16708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1001 ms 16708 KB Output is correct
2 Correct 338 ms 16708 KB Output is correct
3 Correct 139 ms 16708 KB Output is correct
4 Correct 91 ms 16708 KB Output is correct
5 Correct 134 ms 16708 KB Output is correct
6 Correct 101 ms 16708 KB Output is correct
7 Correct 804 ms 16708 KB Output is correct
8 Correct 478 ms 16708 KB Output is correct
9 Correct 165 ms 16708 KB Output is correct
10 Correct 23 ms 16708 KB Output is correct
11 Correct 333 ms 16708 KB Output is correct
12 Correct 27 ms 16708 KB Output is correct
13 Correct 162 ms 16708 KB Output is correct
14 Correct 701 ms 16708 KB Output is correct
15 Correct 404 ms 16708 KB Output is correct
16 Correct 634 ms 16708 KB Output is correct
17 Correct 302 ms 16708 KB Output is correct
18 Correct 282 ms 16708 KB Output is correct
19 Correct 66 ms 16708 KB Output is correct
20 Correct 367 ms 16708 KB Output is correct
21 Correct 235 ms 16708 KB Output is correct
22 Correct 604 ms 16708 KB Output is correct
23 Correct 231 ms 16708 KB Output is correct
24 Correct 117 ms 16708 KB Output is correct
25 Correct 129 ms 16708 KB Output is correct
26 Correct 420 ms 16708 KB Output is correct
27 Correct 43 ms 16708 KB Output is correct
28 Correct 27 ms 16708 KB Output is correct
29 Correct 1125 ms 16708 KB Output is correct
30 Correct 1120 ms 16708 KB Output is correct