当前位置:网站首页>状态压缩复习
状态压缩复习
2022-08-08 05:42:00 【一条小小yu】
简单记录一下,后期慢慢补
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main()
{
//状态压缩复习//
//程序编写1
for(int S=0;S<(1<<n);++S)
for(int i=0;i<n;++i)if(S&(1<<i))//S中含i
for(int j=0;j<n;++j)
if(!(S&(1<<j))&&G[i][j])
dp[j][S|(1<<i)]=min(dp[j][S|(1<<i)],dp[i][S]+G[i][j])
//程序编写2
for(int S=0;S<(1<<n);++S)
for(int i=0;i<n;++i)if(S&(1<<i))
for(int j=0;j<n;++j)
if((S&(1<<j))&&G[j][i])
dp[i][S]=min(dp[i][S],dp[j][S^(1<<i)]+G[j][i]);
return 0;
}
边栏推荐
猜你喜欢

自动化工具

C language - function

Entering the world of audio and video - RGB and YUV formats

Preprocessing Notes

Unity鼠标光标使用学习

Spark entry learning-3-SparkSQL data abstraction

postgresql中连接两张表更新第三张表(updata)

76. The minimum cover substring

Matlab simulation of photovoltaic mppt maximum power control based on disturbance observation method

Filter 过滤器的使用
随机推荐
神经网络一般训练多少次,神经网络训练时间过长
MySQL5
文件操作 - IO
【Redis】Redis学习——事务
Servlet---ServletConfig类使用介绍
Preprocessing Notes
MySQL6
Session 和 Cookie 使用
TCP/IP基本实现
Unity-CharacterController(角色控制器)
如何批量导入文件,并全部自定义重命名为相同文件名
【无标题】暂时没有想好叫什么名字
Hard Disk Basics
TSF Microservice Governance Combat Series (2) - Service Routing
C语言日记 11 switch语句(分支结构程序设计)
postman---postman参数化
浅学软件逆向笔记(1)
Tensorboard的使用 ---- SummaryWriter类(pytorch版)
什么是 DevOps?看这一篇就够了!
The only OpenCyphal/UAVCAN tutorial in the whole network (11) Write a Cyphal protocol parsing tool with candump and gawk tools