加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

spoj5973

发布时间:2020-12-16 07:19:00 所属栏目:百科 来源:网络整理
导读:SP5973 SELTEAM - Selecting Teams #include bits/stdc++.h using namespace std;typedef long long ll;inline ll read(){ ll s = 0 ; bool f= 0 ; char ch= ‘ ‘ ; while (!isdigit(ch)) {f|=(ch== ‘ - ‘ ); ch= getchar();} while (isdigit(ch)) {s=(s

SP5973 SELTEAM - Selecting Teams

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
    ll s=0; bool f=0; char ch= ;
    while(!isdigit(ch)) {f|=(ch==-); ch=getchar();}
    while(isdigit(ch)) {s=(s<<3)+(s<<1)+(ch^48); ch=getchar();}
    return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
    if(x<0) {putchar(-); x=-x;}
    if(x<10) {putchar(x+0); return;}
    write(x/10); putchar((x%10)+0);
}
#define W(x) write(x),putchar(‘ ‘)
#define Wl(x) write(x),putchar(‘n‘)
const int N=100005;
const ll Mod=8388608;
ll T,n,k;
ll C[N][25];
inline void Ad(ll &x,ll y)
{
    x+=y; x-=(x>=Mod)?Mod:0;
}
int main()
{
    ll i,j,ans;
    R(T);
    C[0][0]=1;
    for(i=1;i<=100000;i++)
    {
        C[i][0]=1; for(j=1;j<=min(23ll,i);j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod;
    }
    while(T--)
    {
        R(n); R(k); ans=0;
        for(i=1;i<=min(k,23ll);i++) Ad(ans,C[n][i]*i%Mod*(1ll<<(i-1))%Mod);
        Wl(ans);
    }
    return 0;
}
/*
input
3
2 2
7 1
5 3
output
6
7
165
*/
View Code

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读