Applese 的大奖

https://ac.nowcoder.com/acm/contest/330/H

C++版本一

题解:

std

参考文章:https://blog.csdn.net/weixin_43272781/article/details/85311412

 

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int maxn = 1 << 20;
const int mod = 1e9 + 7;
 
ll Pow(ll a, ll n = mod - 2)
{
    ll t = 1;
    for (; n; n >>= 1, (a *= a) %= mod)
        if (n & 1) (t *= a) %= mod;
    return t;
}
 
int main()
{
    ll _ = Pow(100);
    int n, k, x;
    scanf("%d%d%d", &n, &k, &x);
    ll ans = 0;
    ll C = 1;
    for (int i = 0; i < k; i++)
    {
        ll p = (99 - x) * _ % mod;
        ans = ans + Pow(p, n - i - 1) * Pow(mod + 1 - p, i) % mod * C % mod;
        ans %= mod;
        C = C * (n - 1 - i) % mod * Pow(i + 1) % mod;
    }
    printf("%lld\n", ans);
}

 

全部评论

相关推荐

04-01 16:02
已编辑
武汉工程大学 Java
牛客98843461...:处女面??我还种马面渣男面处男面呢
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务