牛客网暑期ACM多校训练营(第四场)Maximum Mode

牛客网暑期ACM多校训练营(第四场)G Maximum Mode 题解 思维题 链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   Maximum Mode 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 The mode of an integer sequence is the value that... 阅读详情

链接:https://www.nowcoder.com/acm/contest/142/G
来源:牛客网
 

时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 131072K,其他语言262144K
64bit IO Format: %lld

题目描述

The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m of them such that: the rest integers have only one mode and the mode is maximum.

输入描述:

There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:
The first line contains two integers n and m (1 ≤ n ≤ 105, 0 ≤ m < n) -- the length of the sequence and the number of integers to delete.
The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) denoting the sequence.
It is guaranteed that the sum of all n does not exceed 106.

输出描述:

For each test case, output an integer denoting the only maximum mode, or -1 if Chiaki cannot achieve it.

示例1

输入

复制

5
5 0
2 2 3 3 4
5 1
2 2 3 3 4
5 2
2 2 3 3 4
5 3
2 2 3 3 4
5 4
2 2 3 3 4

输出

复制

-1
3
3
3
4

题意:给你n个数的序列,要求去掉m个数,使序列出现一个最大的惟一的众数;若不存在就输出-1;

思路:我写的很麻烦,记录每个数出现的次数,再记录每个次数出现的次数;先求出每个数的次数,然后选出相同次数中最大的数(比如2和3都出现了3次,那么出现3次的数为3),然后遍历符合条件的数,这样就得到了答案;判断条件的话就是先统计每个次数相同的个数,然后维护前缀和,算出要使当前数成为最大的众数序列要减去的个数,与m比较;差不多就这样;

下面附上我的代码:

#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#define LL long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define lson o<<1
#define rson o<<1|1
using namespace std;
const int maxn = 1e5 + 10;
set<int> s;
set<int> s1;
struct node {
	int val;
	int mx;
} a[maxn];
struct node1{
	int vall;
	int mxx;
	int num;
}d[maxn], c[maxn]; 
bool cmp1(node1 c, node1 d)
{
	return c.vall > d.vall;
}
bool cmp2(node1 x, node1 y)
{
	return x.mxx > y.mxx;
}
map<int, int> b;
map<int, int> b1;
map<int, int> p;
int main()
{
	int n, m, k;
	scanf("%d", &k);
	while (k--)
	{
		s.clear();
		b.clear();
		p.clear();
		b1.clear();
		s1.clear();
		scanf("%d %d", &n, &m);
		int x;
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &x);
			b[x]++;//次数 
			s.insert(x);
		}
		set<int>::iterator it;
		int t = 0;
		for(it = s.begin(); it != s.end(); it++)
		{
			a[t].mx = b[*it];
			a[t++].val = *it;
		}
		for(int i = 0; i < t; i++)
		{
			p[a[i].mx]++;//相同次数的个数 
			b1[a[i].mx] = max(b1[a[i].mx], a[i].val);//相同次数的最大值 
			s1.insert(a[i].mx);//去重次数 
		}
		set<int>::iterator iter;
		int v = 0;
		for(iter = s1.begin(); iter != s1.end(); iter++)
		{
			d[v].mxx = *iter;
			d[v].vall = b1[*iter];
			d[v++].num = p[*iter];
		}
		sort(d, d + v, cmp2);
		int r = 0;
		int sum[maxn];
		int sum1[maxn];
		memset(sum, 0, sizeof(sum));
		memset(sum1, 0, sizeof(sum1));
		sum[0] = d[0].mxx * d[0].num;
		sum1[0] = d[0].mxx;
		for(int i = 1; i < v; i++)
				sum[i] = sum[i - 1] + d[i].mxx * d[i].num;
		for(int i = 1; i < v; i++)
				sum1[i] = sum1[i - 1] + d[v - i].num;
		for (int i = 0; i < v; i++)
		{
			if (m >= (sum[v - 1] - sum[i] - (sum1[v - 1] - sum1[i]) * (d[i].mxx - 1) + d[i].num - 1))
				break;
		}
		sort(c, c + r, cmp1);
		if (!r)
			puts("-1");	
		else
			printf("%d\n", c[0].vall);
	}
	return 0;
}

 

【Cubietruck】Qt5.8.0 x64、x86、armhf三个版本的编译安装 一、       Preparation 以下环境配置支持虚拟机和实体机,但是实体机生产效率会相对高一点,实体机编译Qt的速度是虚拟机两倍以上。 若使用虚拟机,推荐使用VirtualBox,开源免费,尽量不要使用Vmware破解版。   Download List   名称 链接 下载项目 OS https://mirro 阅读详情

相关推荐

基于PLC的矿用排水控制系统设计【附代码】

(3)矿用排水控制系统的软件设计 研究设计了矿用排水控制系统的软件,包括PLC程序的编写和上位机监控画面的设计。(2)矿用排水控制系统的硬件设计 研究对矿用排水控制系统的硬件进行了选型和设计,包括矿用多级耐磨离心泵、三相异步防爆电机等执行设备的选型,以及控制系统所需用到的各类型传感器、PLC的I/O点分配及选型。(1)矿用排水控制系统的现状分析 研究首先对矿井排水系统的现状进行了分析,指出了现有系统存在的问题,如自动化程度低、劳动强度大、设备维护困难等。✅ 具体问题可以私信或查看文章底部二维码。

lagougongzuoshi的博客 1183

题解 | tree-2019牛客暑期多校训练营第四场G题

题目来源于牛客竞赛:https://ac.nowcoder.com/acm/contest/discuss 题目描述: 输入描述: 输出描述: 示例1: 题解: 代码: #include<bits/stdc++.h> using namespace std; typedef unsigned int u32; typedef pair<int,int> pii;...

lastbye的博客 367

【自动驾驶端到端5:VADv2: End-to-End Vectorized Autonomous Driving via Probabilistic Planning】

从大规模人类驾驶演示中学习类人驾驶策略是有希望的。但是,规划的不确定性使得从驾驶演示中提取驾驶知识是有挑战性的。从统计学习的角度来看,动作(包括实际和速度)是高度随机的,受许多无法建模的潜在因素影响。

weixin_40000560的博客 1412

牛客多校训练营Maximum Mode

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly ...

Pandapan1997的博客 354

C++构建量化回测框架:从雪球组合信号到策略验证实战

量化回测是策略研发的核心环节,它通过历史数据模拟交易,评估策略的收益风险特征。其原理在于构建一个包含数据获取、信号生成、交易模拟和绩效评估的闭环系统,以检验策略逻辑在历史市场环境中的表现。这项技术的核心价值在于将主观投资思路客观化、系统化,帮助开发者识别策略的有效性与潜在缺陷。在应用场景上,量化回测广泛应用于股票、期货、数字货币等金融市场的策略研发与优化。本文聚焦于使用C++实现一个本地化、自动化的回测框架,重点解析如何高效抓取雪球组合持仓数据,并构建严谨的**回测引擎**以模拟真实交易环境,同时深入探讨了

weixin_30873847的博客 374

如何从RHEL 8升级到RHEL 9

Red Hat 于 2022 年 5 月 17 日宣布全面推出 RHEL 9。这是 RHEL(Red Hat Enterprise Linux)的最新版本,它具有许多功能和增强功能。

u012748257的博客 1024

2019牛客暑期多校训练营(第四场)补题总结(未完待续)

K.number 题意:给一个只有数字构成的字符串,问能整除300的子串有多少 思路:我队友给我描述他写这道题的想法,很神奇,他当时看到这道题脑子里突然浮现了三个光束轮流转的画面,然后一下就写出来了。。。实际上这道题就是三个状态的转移。若我们能找到两个连续的0,那我们就只要找到前面的子串中与这两个0相连的子串中有多少是3的倍数就行了,假如我们确定了与第i字符相连的子串大小模3是0,1,2的个数...

Zookkk的博客 249

瑞芯微RK3568开发板实战:Android11系统parameter.txt文件配置全解析(附常见问题排查)

本文深入解析了瑞芯微RK3568开发板在Android 11系统下parameter.txt文件的配置要点与实战技巧。作为BootLoader启动阶段的核心蓝图,该文件决定了硬件初始化、分区布局及电源管理。文章详细拆解了身份标识、GPIO控制(PWR_HLD)、命令行参数及分区表等关键字段的配置逻辑,并针对RK3568平台与Android 11特性提供了专项适配策略,最后附带了启动失败、分区异常等常见问题的深度排查方法。

php55的博客 904

2018牛客多校训练-----Maximum Mode(贪心)

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网 题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly ...

jinghui_7的博客 283

华为C语言笔试题(附答案)

华为C语言笔试题(附答案)     1、局部变量能否和全局变量重名?   答:能,局部会屏蔽全局。要用全局变量,需要使用 ":: "   局部变量可以与全局变量同名,在函数内引用这个变量时,会用到同名的局部变量,而不会用到全局变量。对于有些编译器而言,在同一个函数内可以定义多个同名的局部变量,比如在两个循环体内都定义一个同名的局部变量,而那个局部变量的作用域就在那个循环体内。  

峰云四起 3042

通过情感分类实例 详细介绍如果借助Huggingface平台 完成Transformers模型运行(包括配置环境-tokenizer-Model-输出头-预测)

attention_mask和padding是配套使用的,当人为去修改padding的时候,也要把attention_mask里面的参数进行修改。下载Huggingface包,Huggingface可以说是一个社区,集成了很多nlp的模型、数据集、预训练权重文件等等,并且免费,只需要pip install下载即可。那么用什么做分类就选择什么输出头,就import什么东西。代码中使用了自动分词器选择,它是由checkpoint指定的预训练模型关联的,不用我们自己选择tokenizer,它自动帮我们选择好了。

LZL2020LZL的博客 1142

牛客网暑期ACM多校训练营(第六场)C.Generation I 组合数+逆元+思维

链接:https://www.nowcoder.com/acm/contest/144/C 来源:牛客网 Oak is given N empty and non-repeatable sets which are numbered from 1 to N. Now Oak is going to do N operations. In the i-th operation, he will insert an integer x between 1 and M to every set indexed

xiuya19的博客 479

基于Python的智能动漫更新监控爬虫系统:从原理到实战

本文详细介绍了如何使用Python构建一个智能化的动漫更新监控系统,涵盖从基础爬虫到高级自动化监控的全套解决方案。文章将深入探讨最新的网络爬虫技术,包括异步请求、反反爬策略、智能解析算法等,并提供完整的代码实现和性能优化方案。通过本系统,用户可以实时获取多个动漫平台的更新信息,并通过多种渠道接收通知。关键词:Python爬虫、动漫监控、自动化通知、异步爬虫、反反爬策略。

2201_76125261的博客 908

牛客网暑期ACM多校训练营(第四场)G.Maximum Mode (思维)

题目链接 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She wou...

Fushicho_XF的博客 518

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

深度学习工具包 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")

牛客网暑期ACM多校训练营(第四场)G Maximum Mode(模拟+思维)

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   Maximum Mode 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 The mode of an integer sequence is the value that...

qq_41668093的博客 306

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

牛客网暑期ACM多校训练营(第四场)G Maximum Mode 【枚举】

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 The mode of an integer sequence is the value that appears most ...

Head_Hard的博客 368

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

牛客网暑期ACM多校训练营(第四场) Maximum Mode(思维)

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 The mode of an integer sequence is the value that appears most ...

辞树 200

牛客网暑期ACM多校训练营(第四场)G Maximum Mode(思维)

链接: https://www.nowcoder.com/login?callBack=%2Facm%2Fcontest%2F142%2FG 题意: 给定n个数, 要求删去恰好m个数后的最大总数是多少。 分析: 要使一个数是众数, 只要比他大的数的数量都比自己小就行。 预处理出全部出现次数的最大数(例如, 出现3次最大的是1,出现2次最大的是2等等)。 然后从最大的次数开始...

dixianqi2609的博客 132

牛客网暑期ACM多校训练营(第四场)G Maximum Mode(思维)

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 题目描述 The mode of an integer sequence is the value that appears most ...

LSD20164388的博客 408

牛客网暑期ACM多校训练营(第四场) G Maximum Mode 思维

链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m o...

weixin_33943347的博客 101

牛客网暑期ACM多校训练营(第四场)G(Maximum Mode)

题目描述  The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m of them such that: the rest integers have only one mod...

snayf的博客 204

牛客网暑期ACM多校训练营(第四场) G

链接:https://www.nowcoder.com/acm/contest/142/G 来源:牛客网   题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly ...

liluoyu_1016的博客 242

牛客网暑期ACM多校训练营(第四场)- (D,F,G)

D Another Distinct Values 题意:用数值1、0、-1来组成一个n*n的矩阵,使得这个矩阵的每一行之和、每一列之和互不相同。 解析:如果n是奇数则构造不出来(还不会证明。。。),如果是偶数则按如下方法构造: 构造方法一:  n=4 1  1  0  0 1  1  0 -1 1  1 -1 -1 1  0 -1 -1 n=6 1  1  1  0  0 ...

Orz 309

牛客第四次多校Maximum Mode

链接:https://www.nowcoder.com/acm/contest/142/G来源:牛客网 题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete ...

weixin_30578677的博客 186
上一篇: 牛客网暑期ACM多校训练营(第四场)Another Distinct Values
下一篇: 牛客网暑期ACM多校训练营(第五场) max
gtuif
博客等级 码龄10年 43粉丝 238原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值