This commit is contained in:
Zengtudor 2024-10-08 19:38:54 +08:00
parent 84d0f094d8
commit 3ec610d927

View File

@ -11,7 +11,7 @@ static void init(){
c[0][0] = c[1][0] = c[1][1] = 1; c[0][0] = c[1][0] = c[1][1] = 1;
for(ull i {2};i<max_n;i++){ for(ull i {2};i<max_n;i++){
c[i][0]=1; c[i][0]=1;
for(ull j{1};j<max_n;j++){ for(ull j{1};j<=i;j++){
c[i][j] = (c[i-1][j-1] + c[i-1][j])%k; c[i][j] = (c[i-1][j-1] + c[i-1][j])%k;
} }
} }
@ -23,11 +23,16 @@ static void init(){
} }
} }
#define NV(v)#v<<" : "<<(v)
int main(){ int main(){
std::cin>>t>>k; std::cin>>t>>k;
std::cout<<NV(t)<<'\n'<<NV(k)<<'\n';
init(); init();
for(ull i {0};i<t;i++){ for(ull i {0};i<t;i++){
std::cout<<NV(t)<<'\n'<<NV(k)<<'\n';
std::cin>>n>>m; std::cin>>n>>m;
std::cout<<"test\n";
m = std::min(m,n); m = std::min(m,n);
std::cout<<(prefix[n][m])<<'\n'; std::cout<<(prefix[n][m])<<'\n';
} }