CodeForces - 1201B - Zero Array ( 思维 )

数据仓库ODS层详解- 功能、设计与最佳实践 数据仓库ODS层是大数据分析的基石,为企业决策提供可靠数据源。本文深入探讨ODS层设计原则、实施要点和最佳实践,涵盖金融、零售等行业应用。重点关注云环境下ODS层部署策略,以及实时数据集成、数据湖技术等创新趋势。文章还分析了数据体量增长、实时性需求等挑战,提供实用解决方案。whether助您构建高效、安全、可扩展的ODS层,为数字化转型奠定坚实基础。#数据仓库 #ODS层 #大数据分析 #云计算 #数据湖 阅读详情
题目链接:点击进入
题目

在这里插入图片描述
在这里插入图片描述

题意

每次可以将两个位置的数-1,问能不能将所有数全变成0.

思路

所有数的和若是奇数一定不行,同时,若是最大的数比其它所有的数的和都大那也不行。
( 记得 long long )

代码
// Problem: Zero Array
// Contest: Virtual Judge - CodeForces
// URL: https://vjudge.net/problem/CodeForces-1201B
// Memory Limit: 262 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

//#pragma GCC optimize(3)//O3
//#pragma GCC optimize(2)//O2
#include<iostream>
#include<string>
#include<map>
#include<set>
//#include<unordered_map>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<fstream>
#define X first
#define Y second
#define best 131 
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define lowbit(x) x & -x
#define inf 0x3f3f3f3f
//#define int long long
//#define double long double
//#define rep(i,x,y) for(register int i = x; i <= y;++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const double pai=acos(-1.0);
const int maxn=1e6+10;
const int mod=1e9+7;
const double eps=1e-9;
const int N=5e3+10;
/*--------------------------------------------*/
inline int read()
{
    int k = 0, f = 1 ;
    char c = getchar() ;
    while(!isdigit(c)){if(c == '-') f = -1 ;c = getchar() ;}
    while(isdigit(c)) k = (k << 1) + (k << 3) + c - 48 ,c = getchar() ;
    return k * f ;
}
/*--------------------------------------------*/

ll n,a[maxn],sum,maxx;

int main() 
{
//	ios::sync_with_stdio(false);
//	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		maxx=max(maxx,a[i]);
		sum+=a[i];
	}
	if((sum&1)||(maxx>sum-maxx)) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
    return 0;
} 
用Charles抓包调试iOS应用?这份保姆级配置指南帮你绕过所有坑 本文提供了一份在Mac上使用Charles抓包调试iOS应用的保姆级配置指南。详细讲解了从Charles安装、Mac端代理设置、根证书安装,到iOS设备连接同一WiFi、配置代理以及最关键的系统证书信任等全流程步骤,并分享了SSL代理规则、断点调试等进阶技巧,帮助开发者高效定位和解决网络请求问题。 阅读详情

相关推荐

瑞萨RA6M4平台I2C驱动移植实战:MPU6050传感器集成指南

本文详细介绍了在瑞萨RA6M4平台上进行I2C驱动移植并集成MPU6050传感器的实战指南。通过FSP配置工具添加I2C主栈,适配MPU6050官方驱动,实现传感器数据读取与调试,为嵌入式开发提供完整的解决方案。

banana的博客 109

Codeforces 1201B

题目链接:https://vjudge.net/problem/CodeForces-1201B 题意:一串数,随便选两个数让它们都减1,问能否让它们全部变成0. 思路:一开始是随便选两个数,然后看能否把它们补齐,但是1 1 100这一组过不了,想了想应该是取最小的和最大的看能否补齐。 #include <bits/stdc++.h> using namespace std; cons...

A 209

STM32L452与FPGA通信翻车?手把手教你关闭I2C时钟延展避坑(附OVR错误解决方案)

本文深入解析STM32L452与FPGA在I2C通信中因时钟延展功能导致的常见问题,提供关闭I2C时钟延展的详细配置方法(NOSTRETCH模式),并针对可能出现的OVR错误给出Combined模式解决方案。通过实战案例和波形分析,帮助工程师快速排查和解决嵌入式系统中的I2C兼容性问题。

e3f4g5的博客 214

CodeForces--1201B--思路

题目链接:http://codeforces.com/problemset/problem/1201/B 思路:总数是偶数,最大的数小于等于总数的一半 /*Examples Input 4 1 1 2 2 6 1 2 3 4 5 6 YES NO Note In the first example, you can make all elements equal to zero in 3 o...

queque_heiya的博客 266

Seedance 2.5、HappyHorse 1.1与豆包Seed 2.1:一周内三大模型技术参数分析

音频生成延续原生音画同步架构,将文本、画面、音频统一序列建模,生成过程同步产出匹配口型的原声音频,支持中、英、日、韩、德、法、阿拉伯7种语言唇形对齐,无需二次调音。从行业趋势看,30秒直出、4K分辨率、7语种唇形同步正在成为视频生成的标配,编程Agent化和多模态理解正在成为语言模型的标配。技术狂奔的同时,监管在同步收紧。我理解这里的关键在于,视频生成模型的商业化落地不仅取决于生成质量,更取决于推理效率——生成一段15秒1080P视频需要多少秒、消耗多少算力,直接决定了模型的商用可行性。

lichunchuan1的博客 323

【ORB-SLAM3】使用安卓手机的摄像头运行ORB3

使用安卓手机的摄像头运行ORB-SLAM3单目

caiqidong321的博客 4994

CodeForces-1201B (思维题)

题目: You are given an arraya1,a2,…,ana1,a2,…,an. In one operation you can choose two elementsaiaiandajaj(i≠ji≠j) and decrease each of them by one. You need to check whether it is possible to ma...

weixin_44757834的博客 777

基于simulink的预测电流控制策略的三相逆变器仿真

本文详细介绍了在Simulink中实现基于预测电流控制策略的三相逆变器仿真方法。主要内容包括:准备工作(安装必要软件及工具箱)、构建三相逆变器基础模型、设计预测电流控制器(包含状态空间建模和控制器设计)、实现控制逻辑、添加示波器观察输出、配置仿真参数以及运行仿真分析结果。通过MATLAB代码示例和Simulink模块说明,展示了如何选择最优开关状态来最小化电流误差。该仿真方法为研究快速响应、高精度的逆变器控制提供了实用工具,但需注意实际应用中可能需要的调试工作。

amy_mhd的博客 274

CodeForces-1201B 思维题

一、内容 题意:给定一个序列,每次选择2个元素(下标不同)分别减去1,问最后能否全部为0。 二、思路 每次减2,所以和必须是偶数。 最大的数必须小于等于 sum/2。 三、代码 #include <cstdio> #define max(a,b) ((a) > (b) ? (a) : (b)) int n, maxNum, num; long long sum; int ma...

Tizzi的博客 730

【AI智能体】Dify 搭建个人专属简历美化助手操作详解

Dify 搭建个人专属简历诊断助手实战操作详解

congge 4380

YOLOv11改进 - 卷积Conv | PConv(Pinwheel-shaped Conv): 风车状卷积用于红外小目标检测 | AAAI 2025

本文介绍了风车状卷积(PConv)和基于尺度的动态(SD)损失在YOLOv11中的结合应用。PConv采用不对称填充,通过特殊结构设计、卷积运算和分组卷积技术,能更好地适应红外小目标的像素高斯空间分布,在少量增加参数的情况下极大扩展感受野。SD损失可根据目标大小动态调整尺度和位置损失的影响。我们将PConv集成到YOLOv11的主干网络低层,并在相关配置文件中进行设置。实验证明,YOLOv11 - PConv在IRSTD - 1K和SIRST - UAVB数据集上取得显著性能提升,验证了方法的有效性和泛化能

魔改工程师的博客 1334

codeforces 1201 B. Zero Array C. Maximum Median(思维)

B. Zero Array 题目链接:codeforces 1201B 题意: 给 n 个数, 要求两个数同时减去1,问能否将其全部变为0 题解: 当数组总和为奇数时,不能变为0 当数组中最大元素大于 总和减去最大元素的值时,不能变为0 AC代码:C++ #include <bits/stdc++.h> using namespace std; ty...

error311的博客 341

基于matlab的CNN手写数字图像矫正系统

CNN 是一款强大的图像特征抽象和提取工具,常用于图像分类识别,并取得了较为理想的效果。我们通过 MATLAB 可以方便地设计不同结构、不同深度的 CNN 进行图像分类,最后一层一般设置为分类层(ClassificationLayer)进行类别标签的输出。如果我们将最后一层设计为回归层(RegressionLayer),则可以将其应用于对连续数据的预测,这对于曲线拟合、预测分析都有重要的意义。% 自定义 CNN 回归网络结构layers = [% 输入% 卷积% 池化% 池化% 卷积。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 675

Codeforces 1201B Zero Array(思维)

传送门 题意:给一个长度为n的非负数列,每次可以选两个数同时减1,问能否将整个数列的数全部归零。 题解:第一波猜结论猜错了(只猜中第一个必要条件“所有数之和为偶数”,也考虑过如果只有两个数那么必须相等)。其实再多想一步就可以发现如果有多个数,那么最大的那个数在不能超过剩下的之和。超过了的话这个最大数无法归零。现在想想如何证明不超过就一定可以归零。 假设最大数为a,次大数为b,剩余的数之和为sum,剩余的数中最大的为c(原数列第三大),我们先用a“消耗”b(同时使a,b减1)直到b==c(这一步一定可以

KGV093的博客 380

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

【CodeForces】 1201B B - Zero Array(思维)

You are given an arraya1,a2,…,an. In one operation you can choose two elementsaiaiandajaj(i≠ji≠j) and decrease each of them by one. You need to check whether it is possible to make all the elem...

Nerdant 406

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

B. Zero Array(cf)思维

原题链接:Problem - 1201B - Codeforces 题目大意:给你n个数(n >= 2),每次选择两个数然后把它们分别减1,问你最后整个数列能不能都为0。 思路: 1.相当于一次减2,最后整个序列的和要为0,那么整个序列的和应该是偶数才行,如果是奇数就直接pass掉; 2.如果数列中最大的数比整个数列的和的一半还大,那么在删除过程中最后这个值是还会多出来值删不掉的,所以如果有这样的情况也不能满足。 AC代码: #include<bits/stdc++.h&gt.

qq_52313416的博客 239

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

codeforces B - Ralph And His Magic Field 找规律

之前比赛以为是组合数,结果没写出来,然后手推规律,发现有个2的幂,但是不知道0的情况怎么解决,没想到打表。。 首先暴力打了个表:#include <bits/stdc++.h> using namespace std; const int mod=1000000007; const int MAXN = 15; int n, m, k; int ans; int a[MAXN][MAXN]; bo

DK 474

codeforces-1201 B Zero Array

1 #include <bits/stdc++.h> 2 #define _for(i,a,b) for(int i = (a);i < b;i ++) 3 typedef long long ll; 4 using namespace std; 5 inline ll read() 6 { 7 ll ans = 0; 8 ...

weixin_30276935的博客 169

Codeforces1201 B C. Maximum Median 二分/数学

B 每次找数组中的一对数-1 最终能否使数组元素全为0 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; //1e9 typedef pair<ll,ll> pll; const int maxn=4e5+5; const i...

qq_40423146的博客 301

Binary Table (Hard Version)-(思维)

题目描述:点击进入 题意 给你一个大小为n×m的二进制表,这个表由符号 0 和符号 1 组成。 你可以进行这样的操作: 选择属于一个 2 × 2 正方形的 3 个不同的单元格,并更改这些单元格中的符号(将 0 更改为1, 1 更改为 0 )。 你的任务是使表中的所有符号都等于0。您最多可以进行 nm次 操作。 你不需要最小化操作的数量。 思路 这是上一题的加强版,操作次数变为 nm 了,我上一次的代码过不去,无奈只能优化,但也只是对边界处理优化了一下,却神奇过了(神奇神奇,用xy哥的话来说那就是可蒸馏啊)

Cosmic_Tree的博客 1780

k-LCM ( easy version && hard version ) -( 思维 - 构造 )

题目链接(easy):点击进入 题目链接(hard):点击进入 题目 题意 长度为 k 的数组,整个数组的和为 n ,整个数组的最小公倍数不超过 n / 2,让你构造这样一个数组 简单版本k=3,困难版本 3 <= k <= n。 思路 简单版本: 因为明确告诉你了 k = 3 ,同时要求三个数的最小公倍数不能超过 n / 2,所以我们可以根据 n 来构造这个三个数。 首先根据 n 的奇偶性分类讨论 如果 n 是奇数,那么三个数可以变为 n / 2 , n / 2 , 1 ; 如果 n 是偶

Cosmic_Tree的博客 1189

Binary Table (Easy Version)-(思维)

题目描述:点击进入 题意 给你一个大小为n×m的二进制表,这个表由符号 0 和符号 1 组成。 你可以进行这样的操作: 选择属于一个 2 × 2 正方形的 3 个不同的单元格,并更改这些单元格中的符号(将 0 更改为1, 1 更改为 0 )。 你的任务是使表中的所有符号都等于0。您最多可以进行 3nm次 操作。 你不需要最小化操作的数量。 思路1 通过找找规律,我们可以知道一个 2*2 的矩阵 不包含0的可以通过一次操作变为包含3个0的, 包含3个0的通过一次操作可以变为包含2个0的, 包含2个0的通过一次

Cosmic_Tree的博客 840

Codeforces Beta Round #68 - B- Train ( 贪心模拟 )

题目链接:点击进入 题目 题意 偷渡者和控制者玩以下游戏。 火车由 n 节车厢表示,车厢从头到尾用 1 到 n 的正整数编号。偷渡者和控制者最初在两辆不同的货车中。火车每分钟都可能处于两种状态移动或空闲。控制者每分钟都在移动。 控制器有运动方向——火车头或火车尾。在移动期间,控制者对应于其移动方向移动到相邻的货车。如果在他的移动结束时,控制者进入第 1 辆或第 n 辆货车,那么他将移动方向更改为另一侧。换句话说,控制者在整个游戏过程中循环地从火车的头部到尾部然后再返回,在每次移动期间移动一辆车。请注意,

Cosmic_Tree的博客 747

CodeForces - 1549C - Web of Lies( 思维 )

题目链接:点击进入 题目 题意 n个人m对朋友关系( 双向 ),q次操作: 1 u v u与v成为朋友 2 u v u与v朋友关系破灭 3 计算以下过程的答案: 过程:所有易受伤害的贵族同时被杀害,他们的友谊也随之结束。这样,新贵族就有可能变得脆弱。这个过程不断重复,直到没有贵族受到伤害。可以证明,这个过程将在有限的时间内结束。完成此过程后,您需要计算剩余贵族的数量。( 如果满足以下两个条件,则贵族被定义为易受攻击:至少有一个朋友,那位贵族的所有朋友都有更高的权力。) 注意,该过程的结果不会在查询

Cosmic_Tree的博客 634

CodeForces 1267

题目:B–Balls of Buma 题意 给你一个字符串(代表不同颜色),让你插入一个字符(一种颜色)后,可以消掉整个字符串。(相同颜色、长度变长、长度>=3才会抵消) 思路 将原串变成“种类串”(例如:AABBAA—> ABA)后,“种类串”应当是回文串,且长度应该是奇数。 同时,一个可以被消去的串,根据中心对称的同类部分的长度和,应当>=3。中心部分长度应当>=2.满足以上条件,答案为中心部分答案+1; 代码 #include<iostream> #include&

Cosmic_Tree的博客 583

CodeForces - 1549D - Integers Have Friends ( 差分 - 线段树 - 双指针 )

题目链接:点击进入 题目 题意 定义一个友好区间为,存在一个 m ( m >= 2 ),使区间内的所有数 % m 值相等,让你求给定数组的最大友好区间长度。 思路 如果两个数 x , y , 取模后的值相同,则需要满足:| x - y | % mod == 0。 若是一个区间内 % mod 值相等,则是所有差值的 gcd。 所以根据这一特性,我们不难想到对原数组差分,然后区间求 gcd( 区间求 gcd 可以用线段树来实现 ),然后我们再用双指针维护一个 右端点 指定 的情况下 左端点最远 且

Cosmic_Tree的博客 577
上一篇: HDU - 1556 - Color the ball ( 差分 )
下一篇: POJ - 2352-Stars ( 树状数组 )
Cosmic_Tree
博客等级 码龄7年 134粉丝 337原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值