news 2026/8/10 2:02:47

3.15 复试训练

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
3.15 复试训练

题目:1.8皇后·改

问题描述

规则同8皇后问题,但是棋盘上每格都有一个数字,要求八皇后所在格子数字之和最大。

输入说明

一个8*8的棋盘。

数据规模和约定

棋盘上的数字范围0~99

输出说明

所能得到的最大数字和

输入范例

1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
48 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64

输出范例

260

个人总结:

1.8皇后就是删去对角线,对角线分别用坐标和和坐标差表示。深搜到深度就和最大值比较大小

#include <iostream> #include <algorithm> using namespace std; int board[8][8]; bool col[8] = {false}; bool diag1[15] = {false}; bool diag2[15] = {false}; int max_sum = 0; void dfs(int row, int current_sum) { if (row == 8) { max_sum = max(max_sum, current_sum); return; } for (int c = 0; c < 8; c++) { int d1 = row - c + 7; int d2 = row + c; if (!col[c] && !diag1[d1] && !diag2[d2]) { col[c] = true; diag1[d1] = true; diag2[d2] = true; dfs(row + 1, current_sum + board[row][c]); col[c] = false; diag1[d1] = false; diag2[d2] = false; } } } int main() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cin >> board[i][j]; } } dfs(0, 0); cout << max_sum << endl; return 0; }

Solid state storage (sometimes called flash memory) stores data in erasable, rewritable circuitry. A memory card is a flat, solid state storage medium commonly used to transfer files from digital cameras and media players to computers. A solid state drive (SSD) is a package of flash memory that can be used as a substitute for a hard disk drive. A USB flash drive is a portable storage device that plugs directly into a computer's system unit using a built-in USB connector.

固态存储(也称作闪存)可擦写、可编程的电路中存储数据的存储设备。存储卡是一种扁平的固态存储介质,通常用于将数码照相机和媒体播放器中的文件传输至电脑。固态硬盘 (SSD)是一组闪存芯片的封装体,可用作硬盘驱动器(HDD)的替代装置。U 盘是一种便携式存储设备,通过其内置的 USB 接口直接与电脑主机相连。

To function, hardware requires physical connections that allow components to communicate and interact. A bus provides a common interconnected system composed of a group of wires or circuitry that coordinates and moves information between the internal parts of a computer. A computer bus consists of two channels: one that the CPU uses to locate data,called the address bus, and another to send the data to that address, called the data bus. A bus is characterized by two features: how much information it can manipulate at one time, called the bus width, and how quickly it can transfer these data.

要正常工作,硬件需要物理连接,使各个部件能够通信并相互作用。总线提供了一套通用的互联系统,由一组导线或电路组成,用于在计算机内部部件之间协调并传输信息。计算机总线包含两个通道:一个供 CPU 用于定位数据,称为地址总线;另一个用于将数据传送到该地址,称为数据总线。总线有两个特征:一次能处理的信息量,称为总线宽度;以及传输这些数据的速度。

A serial connection is a wire or set of wires used to transfer information from the CPU to an external device such as a mouse, keyboard, modem, scanner, and some types of printers. This type of connection transfers only one piece of data at a time, and is therefore slow. The advantage of using a serial connection is that it provides effective connections over long distances.

串行连接是一根或一组导线,用于在中央处理器与外部设备之间传输信息,例如鼠标、键盘、调制解调器、扫描仪和部分打印机。这种连接方式一次只能传输一位数据,因此速度较慢。串行连接的优点是可以在长距离下实现稳定有效的连接。

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/8/10 2:01:59

SpringBoot 线程池报错全集|ThreadPoolTaskExecutor 并发踩坑全解决

在 SpringBoot 项目中&#xff0c;线程池&#xff08;ThreadPoolTaskExecutor&#xff09;是处理并发任务的核心组件&#xff0c;常用于异步处理、批量操作、定时任务等场景。但很多开发者在使用线程池时&#xff0c;总会遇到各种报错&#xff0c;导致并发任务执行失败、服务卡…

作者头像 李华
网站建设 2026/7/14 15:32:40

ROS 2 概念

目录 1. ROS 2 核心概念 2. ROS 2 架构 3. ROS 2 的关键特性 3.1 实时性与性能 3.2 安全性 3.3 跨平台 3.4 多机器人系统 3.5 生命周期管理 3.6 工具链现代化 4. ROS 2 与 ROS 1 的主要区别 5. ROS 2 生态系统 6. 应用场景 7. 总结 1. ROS 2 核心概念 ROS 2 的核心…

作者头像 李华
网站建设 2026/7/14 15:32:41

Keil 生成 bin 文件

打开项目设置,在User, 后处理设置中勾选Run #1,在后面的文本框里输入以下代码, fromelf --bin -o "L.bin" "#L"仅在Keil 5.40 测试通过

作者头像 李华
网站建设 2026/7/14 15:32:42

NIPT检测优化:BMI与孕周对胎儿染色体浓度的影响

一、问题重述 1.1问题背景 1997年,卢煜明教授首次发现孕妇外周血中存在胎儿游离DNA,为无创产前检测奠定了基础。NIPT是一种通过分析孕妇外周血中的胎儿游离DNA片段,利用二代高通量测序技术与生物信息分析技术,分析胎儿是否发生染色体非整倍体变异的一项产前筛查技术。[1]…

作者头像 李华
网站建设 2026/7/14 15:32:41

国产USB3.0转千兆网卡单芯片方案——CH398

简介CH398 是一款高集成度的 USB3.0 千兆网卡芯片&#xff0c;全流程国产化&#xff0c;内置 RISC-V 处理器、符合 USB3.2 Gen1 及 USB2.1规范的控制器及收发器、符合 IEEE802.3 协议规范、支持 10M/100M/1000M 网络的以太网 MACPHY&#xff0c;单芯片即可实现 USB 到以太网的桥…

作者头像 李华