mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-08-31 23:41:41 +00:00
fix(P1896): 修复循环条件错误和逻辑错误
修复循环条件中缺少自增运算符的问题 修正变量名错误导致的逻辑问题 移除调试用的注释代码
This commit is contained in:
parent
505d9e9c4d
commit
88a1760e0d
@ -22,6 +22,7 @@ int main(){
|
||||
std::cin.tie(nullptr);
|
||||
|
||||
std::cin>>n>>K;
|
||||
// std::cout<<n<<" "<<K<<"\n";
|
||||
line.reserve(n*n+1);
|
||||
line.push_back(0);
|
||||
for(ll msk=0;msk<(1ll<<n);++msk){
|
||||
@ -44,8 +45,9 @@ int main(){
|
||||
dp.resize(n+1,std::vector<std::vector<ll>>(line.size(),std::vector<ll>(K+1)));
|
||||
|
||||
|
||||
for(ll j=1;j<line.size();++j){
|
||||
for(ll j=1;j<line.size();j++){
|
||||
ll num1 = get1n(line[j]);
|
||||
if(num1>K)continue;
|
||||
dp[1][j][num1]=1;
|
||||
}
|
||||
|
||||
@ -62,7 +64,7 @@ int main(){
|
||||
){
|
||||
continue;
|
||||
}else{
|
||||
for(ll x=cur1n;x<=K;K++){
|
||||
for(ll x=cur1n;x<=K;x++){
|
||||
dp[i][j][x]+=dp[i-1][k][x-cur1n];
|
||||
}
|
||||
}
|
||||
|
11
src/8/30/P1896_pai.cpp
Normal file
11
src/8/30/P1896_pai.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
||||
std::random_device rd{};
|
||||
|
||||
std::mt19937 mt{rd()};
|
||||
|
||||
int main(){
|
||||
std::uniform_int_distribution uni1{1,9}, uni2{1,81};
|
||||
std::cout<<uni1(mt)<<" "<<uni2(mt)<<"\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user