计蒜客蓝桥B组模拟赛五-F. 藏宝图

2018年计蒜客蓝桥杯模拟赛(2018.3.25)题解(未完待续) (题解参考:2018年蓝桥杯模拟赛第五场题解  by islands)一、题目列表1. (3')矩阵求和        给你一个n×n的矩阵,里面填充1到n×n。例如当n等于3的时候,填充的矩阵如下。        1 2 3        4 5 6        7 8 9        现在我们把矩阵中的每条边的中点连起来,这样形成了一个新的矩形,请你计算一下这个新的矩形的覆盖的数字的和。比... 阅读详情

蒜头君得到一张藏宝图。藏宝图是一个 10 \times 1010×10 的方格地图,图上一共有 1010 个宝藏。有些方格地形太凶险,不能进入。

整个图只有一个地方可以出入,即是入口也是出口。蒜头君是一个贪心的人,他规划要获得所有宝藏以后才从出口离开。

藏宝图上从一个方格到相邻的上下左右的方格需要 11 天的时间,蒜头君从入口出发,找到所有宝藏以后,回到出口,最少需要多少天。

思路:

状压10个状态,然后bfs就行了,,

没想到到现在还会犯"<<和"-"优先级的错误,mdzz...

代码:

import java.util.HashMap;
import java.util.LinkedList;

public class Main6 {

	private static class Node implements Comparable<Node>{
		int x, y, t, vis;
		public Node(int x, int y, int t, int vis) {
			this.x = x;
			this.y = y;
			this.t = t;
			this.vis = vis;
		}
		@Override
		public int compareTo(Node o) {
			// TODO Auto-generated method stub
			return this.t - o.t;
		}
		
	}
	private static String[] mp = {"O......B..",
								  "...X..B...",
								  ".X..B..X..",
								  ".B...X..B.",
								  ".X..B.X...",
							  	  "..X....X..",
								  ".....X..B.",
								  ".X.X..B...",
								  ".B....XX..",
								  "..X..XB..."
								};
	private static int nex[][] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
	private static boolean[][][] vis = new boolean[1<<10][15][15];
	private static HashMap<Integer, Integer> map = new HashMap<>();
//	private static PriorityQueue<Node> q = new PriorityQueue<>();
	private static LinkedList<Node> q = new LinkedList<>();
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ids = 0;
		System.out.println(bfs());
	}
	
	private static int ids;
	private static int ID(int x, int y) {
		if(map.containsKey(x*10+y)) {
			return map.get(x*10+y);
		}
		map.put(x*10+y, ids);
		return ids++;
	}
	private static int bfs() {
		q.offer(new Node(0, 0, 0, 0));
		vis[0][0][0] = true;
		while(!q.isEmpty()) {
			Node top = q.poll();
			if(top.vis == ((1<<10)-1) && top.x == 0 && top.y == 0) {
				return top.t;
			}
			for(int i = 0; i < 4; ++i) {
				int tx = top.x + nex[i][0];
				int ty = top.y + nex[i][1];
				if(tx < 0 || tx >= 10 || ty < 0 || ty >= 10) {
					continue;
				}
				if(mp[tx].charAt(ty) == 'X') {
					continue;
				}
				if(vis[top.vis][tx][ty]) {
					continue;
				}
				int tmp = top.vis;
				if(mp[tx].charAt(ty) == 'B') {
					int id = ID(tx, ty);
					if((top.vis & (1<<id)) == 0) {
						tmp += (1<<id);
					}
				}
				q.offer(new Node(tx, ty, top.t+1, tmp));
				vis[tmp][tx][ty] = true;
			}
		}
		return -1;
	}

}


继续加油~

几何画板课件集锦 几何画板课件集锦,很好的课件,实用于初学者。 立即下载

相关推荐

工业级越界行为识别数据集:YOLOv8/v9直接训练的围栏异常检测资源

越界行为识别是智能安防与工业安全中的基础视觉任务,其核心在于对人员、车辆等目标跨越物理边界(如围栏、警戒线、作业禁区)的精准检测与分割。该技术依赖于高质量实例分割标注、归一化坐标格式及场景鲁棒性设计,具备低延迟、高召回、强泛化等工程价值,广泛应用于智慧工地电子围栏、化工厂禁区告警、物流园区越界监控及变电站安全巡检等真实工业场景。本数据集以YOLOv8/v9为基准构建,提供万张实拍+合成图像、像素级Segmentation标注、分层划分与完备元数据,开箱即用,直击工业落地中数据清洗、格式转换与标注不一致等关键

weixin_30080745的博客 317

计蒜客 藏宝图 (bfs + 状压)

传送门思路:典型的bfs + 状压啊,一个入口出口,还要拿到地图中多个东西,而且同一个点重复走的话不好标记,这时候就标记状态啊/。。md,退役垃圾狗。。。答案 :48    PS:    这里走回出口没必要在跑一遍bfs,只需要走到出口时判断一下是否所有箱子都拿到了即可。#include &lt;bits/stdc++.h&gt; using namespace std; int a[15][1...

Marcus-Bao的个人主页 870

基于ADS\HFSS\Matlab的平面带通发夹滤波器设计

写在最前面,前段时间完成了一个小项目,实现13.5~14GHz的带通滤波器,算是第一个微波项目,在老师、学长、各种大神的指点下,最终完成了指标,想来这段时间收获良多,想到老师教导的,有能力的话要尽可能帮助别人,以及网络上很少面向于小白的教程,于是决定把自己做这个小项目的经过,一些关键步骤,还有软件操作和公式讲解都发出来,供大家指正借鉴。由于我目前大三,刚学习电磁场、微波工程等等,技术实在有限,同时这样是我第一次发帖子,只能尽可能的将自己确认过正确的内容,步骤以及一些经验写出来,供大家借鉴。

likaifeng12138的博客 5221

计蒜客蓝桥杯模拟五---藏宝图

#include&lt;iostream&gt; #include&lt;queue&gt; #include&lt;cstring&gt; #include&lt;algorithm&gt; using namespace std; struct node { int id,x,y,len; }; struct node N[15]; int dis[15][15]; int dir...

hg_zhh 557

基于STM32的录音机设计(STM32F103+VS1053B)

本项目设计并实现了一款基于STM32微控制器的便携式录音机。该录音机采用STM32F103C8T6作为主控芯片,结合VS1053B音频编解码模块、SD卡存储、OLED显示屏以及按键模块,提供了手动录音、自动录音和录音回放等多种功能。

1万+

uniapp [安卓苹果App端] - 实现获取手机日历读写权限+调用本机日历数据及操作功能+日历中插入事项事件提醒,检测权限手机日历权限是否开启并引导用户同意授权,uniApp app端开启日历授权

uni-app,权限,手机日历权限,安卓Android,苹果ios,uniapp安卓android获取本机日历读写权限使用,uni-app获取日历权限并实现插入事项事件功能 uniapp苹果IOS系统不支持怎么办,判断权限,权限被拒绝了怎么办,获取日历权限报错,读取日历数据农历阴历并操作插入移除,给用户手机日历中放入一条提示,UniApp调用日历进行读写,打包上架后如何获取,安卓ios权限检测,安卓和ios权限获取,uniapp的APP端日历读写权限与使用示例代码,如何开启日历权限,日历的新增事项和删除,判

🏆 前端领域优质创作者 1万+

计蒜客-藏宝图(bfs+状压)

藏宝图 蒜头君得到一张藏宝图。藏宝图是一个 10×1010 \times 1010×10 的方格地图,图上一共有 101010 个宝藏。有些方格地形太凶险,不能进入。整个图只有一个地方可以出入,即是入口也是出口。蒜头君是一个贪心的人,他规划要获得所有宝藏以后才从出口离开。藏宝图上从一个方格到相邻的上下左右的方格需要 111 天的时间,蒜头君从入口出发,...

codeswarrior的博客 768

支持UE4.27、UE5.0、UE5.1、UE5.2、UE5.3、UE5.4、UE5.5的VS2022一键安装方法

本文提供了两种安装VS2022以支持UE5开发的方案。方案一通过百度网盘提供一键安装包,下载解压后以管理员身份运行批处理文件即可完成安装。方案二需从微软官网下载安装程序,通过创建包含特定参数的批处理文件来自定义安装组件。两种方案都需保持联网环境,建议先卸载旧版VS。安装完成后可测试打包UEC++项目Windows包。

2501_93651177的博客 354

2018 蓝桥杯省赛 B 组模拟赛(五) F. 结果填空:藏宝图

蒜头君得到一张藏宝图。藏宝图是一个 10 \times 1010×10 的方格地图,图上一共有 1010 个宝藏。有些方格地形太凶险,不能进入。 整个图只有一个地方可以出入,即是入口也是出口。蒜头君是一个贪心的人,他规划要获得所有宝藏以后才从出口离开。 藏宝图上从一个方格到相邻的上下左右的方格需要 11 天的时间,蒜头君从入口出发,找到所有宝藏以后,回到出口,最少需要多少天

Become hunger become strong 694

实战六十四:基于机器学习朴素贝叶斯的豆瓣Top250影评的情感分析与预测 附完整源码和数据

实战六十四:基于机器学习朴素贝叶斯的豆瓣Top250影评的情感分析与预测 附完整源码和数据

1565

利用dddd_trainer训练通用验证码识别模型

博文介绍了使用dddd_trainer工具训练自定义验证码识别模型的过程,详细展示了从环境搭建、数据集准备到模型训练的全流程。

九月镇灵将的博客 1033

2018 蓝桥杯省赛 B 组模拟赛(五)

计蒜客蓝桥杯省赛 B 组模拟赛网址  https://www.jisuanke.com/contest/1215A题:矩阵求和给你一个从 n×n 的矩阵,里面填充 11 到 n×n 。例如当 nn 等于 33 的时候,填充的矩阵如下。1 2 34 5 67 8 9现在我们把矩阵中的每条边的中点连起来,这样形成了一个新的矩形,请你计算一下这个新的矩形的覆盖的数字的和。比如,n = 3n=3 的时候矩...

nsu_zser的博客 598

Agent驱动电商运营:从选品到售后的全链路革新

在当今竞争激烈的电商市场中,传统的电商运营模式面临着诸多挑战。从选品到售后,每个环节都需要大量的人力投入和专业知识。选品需要深入了解市场趋势和消费者需求,营销需要精准定位目标用户,客服需要24小时响应用户咨询。这些工作不仅耗时耗力,而且容易受到人为因素的影响,导致效率低下和成本高企。AI Agent是一种能够感知环境、做出决策并采取行动的智能系统。感知能力:能够获取和处理环境信息。决策能力:能够根据感知到的信息做出决策。行动能力:能够执行决策,对环境产生影响。学习能力。

AI 领航者的博客 354

计蒜客蓝桥c语言答案,计蒜客:2018 蓝桥杯省赛 B 组模拟赛(五)题目题解

A.结果填空:矩阵求和#include #include using namespace std;const int n = 101;long long a[110][110];int main() {long long cnt = 1;for(int i = 1; i <= n; i++) {for(int j = 1; j <= n; j++) {a[i][j] = cnt++;...

weixin_39603573的博客 248

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

计蒜客:2018 蓝桥杯省赛 B 组模拟赛(五)题目题解

A.结果填空:矩阵求和#include &lt;iostream&gt; #include &lt;stdio.h&gt; using namespace std; const int n = 101; long long a[110][110]; int main() { long long cnt = 1; for(int i = 1; i &lt;= n; i++) {...

温姑娘的博客 3788

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

【计蒜客】2018 蓝桥杯省赛 B 组模拟赛(五) ---- 结果填空:藏宝图

思路: 自己还是做题做的少呀,一位一次BFS就够了,没有那么简单。这个题目要求出每两个宝藏之间(把起点也算进去)的最短距离, 共计 11 个点,然后枚举,找到最短的一条回路(环)。这样子其实就是把这个藏宝图上的藏宝点和起点看成一张新的地图,构建成了无向图。这样子就很容易得到结果了。 感谢@zudikn 超霸的指点~ AC代码: #include &lt;iostream&gt; #...

WangMeow --- ᶘ ᵒᴥᵒᶅ ฅ^•ﻌ•^ฅ 353

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

2018 蓝桥杯省赛 B 组模拟赛(五) F. 结果填空:藏宝图

蒜头君得到一张藏宝图。藏宝图是一个 10 \times 1010×10 的方格地图,图上一共有 1010 个宝藏。有些方格地形太凶险,不能进入。整个图只有一个地方可以出入,即是入口也是出口。蒜头君是一个贪心的人,他规划要获得所有宝藏以后才从出口离开。藏宝图上从一个方格到相邻的上下左右的方格需要 11 天的时间,蒜头君从入口出发,找到所有宝藏以后,回到出口,最少需要多少天。跑了1分钟左右。才出来48...

JUST CODE IT 1026

2018 蓝桥杯省赛 B 组模拟赛(五)F. 结果填空:藏宝图

蒜头君得到一张藏宝图。藏宝图是一个 10 \times 1010×10 的方格地图,图上一共有 1010 个宝藏。有些方格地形太凶险,不能进入。 整个图只有一个地方可以出入,即是入口也是出口。蒜头君是一个贪心的人,他规划要获得所有宝藏以后才从出口离开。 藏宝图上从一个方格到相邻的上下左右的方格需要 11 天的时间,蒜头君从入口出发,找到所有宝藏以后,回到出口,最少需要多少天。 #inc...

北里五井的博客 264

2018 蓝桥杯省赛 B 组模拟赛(五)题 F题

蒜头君得到一张藏宝图。藏宝图是一个 10×1010 \times 1010×10 的方格地图,图上一共有 101010 个宝藏。有些方格地形太凶险,不能进入。整个图只有一个地方可以出入,即是入口也是出口。蒜头君是一个贪心的人,他规划要获得所有宝藏以后才从出口离开。藏宝图上从一个方格到相邻的上下左右的方格需要 111 天的时间,蒜头君从入口出发,找到所有宝藏以后,回到出口,最少需要多少天。代码如下:...

咸鱼一号的博客 228

计蒜客 藏宝图

题目链接:藏宝图 说两种解法。 1.由于十个点都要走一次,所以可以枚举10个藏宝点的全排列,再把起点$(0,0)$和终点$(0,0)$放在排列的首尾,用11次bfs即可获得一种走法的最短路径。 2.把用二进制来表示每个藏宝点,$(x,y,status)$表示获得了status的宝物,来到了点$(x,y)$ 贴出位压代码: #include <stdio.h> #incl...

weixin_30691871的博客 163

计蒜客 2018 蓝桥杯省赛 B 组模拟赛(五)

A. 结果填空:矩阵求和(3分)给你一个n×n的矩阵,里面填充 1 到 n×n 。例如当 n 等于 3 的时候,填充的矩阵如下。1 2 3 4 5 6 7 8 9现在我们把矩阵中的每条边的中点连起来,这样形成了一个新的矩形,请你计算一下这个新的矩形的覆盖的数字的和。比如,n = 3 的时候矩形覆盖的数字如下。       24     5     6       8那么当 n 等于 101 的时候...

hopyGreat的博客 635

NOIP2013货车运输 计蒜客习题 蒜头君运送宝藏

手画样例容易发现每次询问所求答案为路径上的最小边而最大生成树的最小边一定是所有生成树中最大的 且原图的连通性不变指定每个连通块中的任意一个结点为根建树 可以发现每次询问的货车路径经过他们的LCA可以在求LCA的同时维护最小边的信息 同样用一个倍增数组 而判断连通可以用并查集半个周日都献给这题了丂点击打开链接#include&lt;bits/stdc++.h&gt; using namespace...

YjmStr 449

计蒜客-蒜头君下棋(找规律)

蒜头君下棋 蒜头君喜欢下棋。最近它迷上了国际象棋。国际象棋的棋盘可以被当做一个 8×88\times 88×8 的矩阵,棋子被放在格子里面(不是和中国象棋一样放在线上)。蒜头君特别喜欢国际象棋里面的马,马的移动规则是这样的:横着走两步之后竖着走一步,或者横着走一步之后竖着走两步。例如,一匹马在 (3,3)(3,3)(3,3) 的位置,则它可以到达的地方...

codeswarrior的博客 776

藏宝图

思路:对于10个宝藏和1个起点,共11个点,先求出这些点两两之间的最短路,然后对10个宝藏拿取的先后顺序进行全排列,然后求一下环的距离。#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;queue&gt; #include &lt;algorithm&gt; #define inf 0x3f3f3f3f using ...

何世全的博客 834

计蒜客 藏宝图(TSP问题)

题意:中文;思路:其实和我访问量最高的那篇哈利波特偷宝藏有点类似,因为需要在回去所以我直接TSP写了,首先抽点建图,只走最短路,存到dis[i][j]数组,表示的是从第i个点到第j个点的最短距离(利用bfs求一哈),之后就抽象出我有n个城市,每次只能走一遍,走完全程在回到起点的最短距离是多少(TSP问题)上代码把;   #include &lt;bits/stdc++.h&gt; using na...

wjmwsgj的博客 332

计蒜客 宝藏 (状压DP)

---- **链接 : **[Here!](https://nanti.jisuanke.com/t/18546) **思路 : ** - 状压DP. 开始想直接爆搜, T掉了, 然后就采用了状压DP的方法来做. - 定义$f[S]$为集合$S$的最小代价, $dis[i]$则记录第$i$个点的"深度", 所以说边$E{[i, j]}$ 的工程代价就为$dis[i]

OhohOh 640
上一篇: 计蒜客蓝桥B组模拟赛五-C. 连连看
下一篇: 蓝桥杯-扑克序列(Java全排列的实现)
薄层
博客等级 码龄10年 242粉丝 289原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值