当前位置:网站首页>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;
}边栏推荐
- 一大波開源小抄來襲
- Compilation of libwebsocket
- tn-c为何不可用2p断路器?
- Design and implementation of online snack sales system based on b/s (attached: source code paper SQL file)
- There are software load balancing and hardware load balancing. Which one to choose?
- CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
- How can I take a shortcut to learn C language in college
- Several ways of MySQL database optimization (pen interview must ask)
- 112 pages of mathematical knowledge sorting! Machine learning - a review of fundamentals of mathematics pptx
- 五月集训总结——来自阿光
猜你喜欢

Automation sequences of canoe simulation functions

Learning SCM is of great help to society

Segmentation sémantique de l'apprentissage profond - résumé du code source

Nc17 longest palindrome substring

Listen to my advice and learn according to this embedded curriculum content and curriculum system

Several silly built-in functions about relative path / absolute path operation in CAPL script
![[flask] crud addition and query operation of data](/img/fc/7a12ede31befed5f42b32b94ae5ecf.jpg)
[flask] crud addition and query operation of data

MapReduce instance (V): secondary sorting

DCDC power ripple test

Oom happened. Do you know the reason and how to solve it?
随机推荐
Hero League rotation chart manual rotation
【深度学习】语义分割:论文阅读:(2021-12)Mask2Former
If a university wants to choose to study automation, what books can it read in advance?
嵌入式中的合作开发--函数指针
[one click] it only takes 30s to build a blog with one click - QT graphical tool
Mapreduce实例(五):二次排序
max-flow min-cut
Mapreduce实例(七):单表join
[untitled]
Teach you how to write the first MCU program hand in hand
六月刷题02——字符串
Nc29 search in two-dimensional array
CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
Leetcode:608 树节点
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
学习单片机对社会的帮助是很大的
Listen to my advice and learn according to this embedded curriculum content and curriculum system
Mapreduce实例(九):Reduce端join
[CV] target detection: derivation of common terms and map evaluation indicators
Popularization of security knowledge - twelve moves to protect mobile phones from network attacks