标签:data- lap c++ void mes input tin ams lin
#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 */
标签:data- lap c++ void mes input tin ams lin
原文地址:https://www.cnblogs.com/gaojunonly1/p/11203399.html