当前位置:网站首页>Blue Bridge Cup seven segment code (dfs/ shape pressing + parallel search)
Blue Bridge Cup seven segment code (dfs/ shape pressing + parallel search)
2022-06-24 07:33:00 【Lin Shiliu should work hard】

#include<iostream>
#include<queue>
#include<cmath>
#include<cstring>
using namespace std;
int g[10][10];
//abcdefg
//0123456
int p[10];
bool vis[10];
int res;
void init()
{
for(int i=0;i<10;i++) p[i]=i;
memset(vis,false,sizeof vis);
}
int find(int x)
{
if(p[x]!=x) p[x]=find(p[x]);
return p[x];
}
void solve()
{
for(int i=1;i<1<<7;i++)
{
init();
int st=i;
for(int j=0;j<7;j++)
if(st>>j&1)
vis[j]=true;
for(int j=0;j<7;j++)
for(int k=0;k<7;k++)
if(vis[j]&&vis[k]&&g[j][k]==1)
{
int a=find(j),b=find(k);
if(a!=b) p[a]=b;
}
int t=0;
for(int j=0;j<7;j++)
if(p[j]==j&&vis[j]) t++;
if(t==1) res++;
}
}
int main()
{
g[0][1]=g[0][5]=1;
g[1][0]=g[1][6]=g[1][2]=1;
g[2][1]=g[2][6]=g[2][3]=1;
g[3][2]=g[3][4]=1;
g[4][5]=g[4][6]=g[4][3]=1;
g[5][0]=g[5][4]=g[5][6]=1;
g[6][1]=g[6][2]=g[6][4]=g[6][5]=1;
solve();
cout<<res;
}
边栏推荐
- Selector (>, ~, +, [])
- buuctf misc 从娃娃抓起
- [image fusion] image fusion based on pseudo Wigner distribution (PWD) with matlab code
- 简单使用Modbus转BACnet网关教程
- [Proteus] Arduino uno + ds1307+lcd1602 time display
- jarvisoj_level2
- Summary of 2022 blue team HW elementary interview questions
- Accessing user interface settings using systemparametersinfo
- Learning to use BACnet gateway of building control system is not so difficult
- Hubei College Upgraded to undergraduate - Hushi family planning department
猜你喜欢

Dichotomous special training

When MFC uses the console, the project path cannot have spaces or Chinese, otherwise an error will be reported. Lnk1342 fails to save the backup copy of the binary file to be edited, etc

How can win11 set the CPU performance to be fully turned on? How does win11cpu set high performance mode?
![[WUSTCTF2020]alison_likes_jojo](/img/a9/dcc6f524772cd0b8781289cbaef63f.png)
[WUSTCTF2020]alison_likes_jojo

Leetcode probability interview shock series 11~15

MFC使用控制台时 项目路径中不能有空格和中文,否则会报错误 LNK1342 未能保存要编辑的二进制文件的备份副本等

软件性能测试分析与调优实践之路-JMeter对RPC服务的性能压测分析与调优-手稿节选

现货黄金有哪些眩人的小技术?

捏脸师: 炙手可热的元宇宙造型师

相机标定(标定目的、原理)
随机推荐
A penetration test of c/s Architecture - Request encryption, decryption and test
Actual target shooting - skillfully use SMB to take down the off-line host
Dichotomous special training
[WUSTCTF2020]alison_ likes_ jojo
[pointnet] matlab simulation of 3D point cloud target classification and recognition based on pointnet
(CVE-2020-11978)Airflow dag中的命令注入漏洞复现【vulhub靶场】
What is a CC attack? How to judge whether a website is attacked by CC? How to defend against CC attacks?
简单使用Modbus转BACnet网关教程
20 not to be missed ES6 tips
[从零开始学习FPGA编程-41]:视野篇 - 摩尔时代与摩尔定律以及后摩尔时代的到来
【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码
【图像融合】基于伪 Wigner 分布 (PWD) 实现图像融合附matlab代码
现货黄金有哪些值得借鉴的心态
How to turn on win11 notebook power saving mode? How to open win11 computer power saving mode
【Proteus】Arduino UNO + DS1307+LCD1602时间显示
[cnpm] tutorial
[GUET-CTF2019]zips
Analog display of the module taking software verifies the correctness of the module taking data, and reversely converts the bin file of the lattice array to display
Spark stage and shuffle for daily data processing
关于取模数据序号定位的说明 区码定位是指GBK编码