当前位置:网站首页>Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
Contest3145 - the 37th game of 2021 freshman individual training match_ C: Tour guide
2022-07-06 09:53:00 【This question AC sleep again】
//
#include<bits/stdc++.h>
using namespace std;
const int MAXN=11;
int a[MAXN][MAXN];
bool used[MAXN];
int n,ans;
void init()
{
memset( a,0,sizeof( a ) );
memset( used,0,sizeof( used ) );
ans=0;
}
// Judgment No. x A student The current total is sum
void dfs( int x,int sum )
{
if( x==n ) { ans=max( ans,sum ); return ; }
int i,j;
for( i=x;i<n;i++ )
{
for( j=0;j<n;j++ )
{
if( used[j]==false )
{
used[j]=true;
dfs( i+1,sum+a[i][j] );
used[j]=false;
}
}
}
}
int main()
{
int i,j; init();
while( ~scanf("%d",&n) )
{
for( i=0;i<n;i++ )
{
for( j=0;j<n;j++ )
{
scanf("%d",&a[i][j]);
}
}
dfs( 0,0 );
printf("%d\n",ans);
init();
}
return 0;
}
边栏推荐
- C杂讲 文件 续讲
- Mapreduce实例(七):单表join
- Canoe CAPL file operation directory collection
- Day 5 of MySQL learning
- Mapreduce实例(四):自然排序
- If a university wants to choose to study automation, what books can it read in advance?
- 解决小文件处过多
- Function description of shell command parser
- CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
- 发生OOM了,你知道是什么原因吗,又该怎么解决呢?
猜你喜欢
大学想要选择学习自动化专业,可以看什么书去提前了解?
DCDC power ripple test
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
Automation sequences of canoe simulation functions
Redis distributed lock implementation redison 15 questions
C杂讲 文件 续讲
《ASP.NET Core 6框架揭秘》样章发布[200页/5章]
CAPL 脚本打印函数 write ,writeEx ,writeLineEx ,writeToLog ,writeToLogEx ,writeDbgLevel 你真的分的清楚什么情况下用哪个吗?
[one click] it only takes 30s to build a blog with one click - QT graphical tool
嵌入式开发比单片机要难很多?谈谈单片机和嵌入式开发设计经历
随机推荐
May brush question 27 - figure
Listen to my advice and learn according to this embedded curriculum content and curriculum system
零基础学习单片机切记这四点要求,少走弯路
Day 5 of MySQL learning
Delayed note learning
Function description of shell command parser
Some thoughts on the study of 51 single chip microcomputer
Vs All comments and uncomments
Can I learn PLC at the age of 33
[deep learning] semantic segmentation: paper reading: (2021-12) mask2former
Design and implementation of online snack sales system based on b/s (attached: source code paper SQL file)
Mapreduce实例(七):单表join
Competition vscode Configuration Guide
Hero League rotation map automatic rotation
018.有效的回文
[deep learning] semantic segmentation: thesis reading (neurips 2021) maskformer: per pixel classification is not all you need
CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
Libuv thread
Hugo blog graphical writing tool -- QT practice
一大波开源小抄来袭