CodeForces 1555A - PizzaForces ( 思维 )

从Pikachu靶场实战解析越权漏洞:原理、攻击与防御 本文通过Pikachu靶场实战详细解析越权漏洞的原理、攻击方式与防御策略。文章深入探讨水平越权和垂直越权的危害,结合代码示例展示漏洞利用过程,并提供代码层和架构层的立体化防御方案,帮助开发者有效防范这一Web安全隐形杀手。 阅读详情
题目链接:点击进入
题目

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

题意

6 片的披萨 15 分钟,8 片的披萨 20 分钟,10 片的披萨 25 分钟, n 个人,一个人至少一片披萨,问最少需要多少分钟才能满足所有人都至少一片披萨

思路

对于小于 6 的按 6 来算。
对于大于等于 6 的,可以先看 n % 6 的值,若等于 0 ,则时间 n / 6 * 15;
若小于等于 2 ,则取出一个 6 凑成 8 ,这样最优,时间 ( n / 6 - 1 ) * 15 + 20 ;
若小于等于 4 ,则取出一个 6 凑成 10 ,这样最优,时间 ( n / 6 - 1 ) *15 + 25 ;
若等于 5 ,则直接再来个 6 ,时间 ( n / 6 + 1 ) * 15 ;

代码(若是被hack会再回来改的。。应该不会被hack吧,炸裂)
//#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=998244353;
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 ;
}

int t,n,m,k;


signed main() 
{
//	ios::sync_with_stdio(false);
//	cin.tie(0);cout.tie(0);
	cin>>t;
	while(t--)
	{
		cin>>n;
		if(n<=6)
			cout<<15<<endl;
	    else
		{
			int k=n/6,ans;
			if(n%6==0)
				ans=k*15;
			else if(n%6<=2)
				ans=(k-1)*15+20;
			else if(n%6<=4)
				ans=(k-1)*15+25;
			else
				ans=(k-1)*15+30;
			cout<<ans<<endl;
		}
	}
    return 0;
} 

【Proteus仿真】51单片机+DAC0832+数码管制作0-25V电压可调 阅读详情

相关推荐

从Podfile到分享成功:ShareSDK小红书模块集成全流程实战(附视频分享代码)

本文详细介绍了iOS应用如何通过ShareSDK集成小红书分享功能的全流程,包括环境配置、SDK初始化、图片和视频分享实现,以及常见问题排查和性能优化策略。特别针对视频分享这一高频需求场景,提供了完整的代码示例和实战技巧,帮助开发者快速实现社交分享功能。

weixin_42540248的博客 226

Codeforces round #1550 Educational Codeforces Round 111 [Rated for Div. 2] (A~C)题解

题目链接 目录A - Find The ArrayB - Maximum Cost DeletionC - Manhattan Subarrays A - Find The Array 题意:如果一个数组中任一aia_{i}ai​满足以下条件之一则称为好数组 1.aia_{i}ai​=1 2.aia_{i}ai​-1或aia_{i}ai​-2至少一个存在于数组中 给出数组的和sss,问最小长度的好数组长度为多少 思路:观察后,由等差数列求和公式发现一个长度为nnn的好数组元素之和的范围是[n(1+n)2\f

rivego的博客 286

别再手动配IP了!用NI-USRP Configuration Utility快速搞定USRP 2954与LabVIEW连接

本文详细介绍了如何使用NI-USRP Configuration Utility快速配置USRP 2954与LabVIEW的连接,解决传统手动IP配置的繁琐问题。通过图形化工具自动完成设备发现、IP设置和连接验证,大幅提升软件无线电实验效率,特别适合信号收发应用场景。

weixin_27102543的博客 292

1550A. Find The Array

https://codeforces.com/problemset/problem/1550/A 题意 给出一个x数字,用这个数字构造出一组特殊的正数序列,满足如下条件 数字之和为x 每一个数字都是漂亮数 漂亮数aia_iai​定义:ai=1a_i=1ai​=1,或者存在aj=ai−1a_j=a_i-1aj​=ai​−1 或aj=ai−2a_j=a_i-2aj​=ai​−2 现在求用x构造出这种序列的最小长度 题解 最小的一个数字一定是1,如果要使得序列最长,当序列长度为3的时候,间隔拉满,数字x最

摸鱼博客 315

从Oracle迁移数据到Hadoop

目标:把Oracle 下的数据文件迁移到 Hadoop , 数据表都是上亿条,每个数据表的空间都超过100G。 关键是建立数据文件是UTF8格式,这样数据中的汉字在Hadoop 里显示才正常。 平台:CentOS 6.10 工具:Python 2.7 cx_Oracle 库 Oracle10.2.0.4.0 Hadoop 2.7.2-transwarp-5.2.1 1. 查看表...

预则立 4234

普通人如何上岸华为OD-面试总结

总共有3道算法题,100分值的两道,200分值的一道,不同的毕业院校和专业,通过机试的分值不一样,最少需要150分通过,提前和hr联系,了解自己需要多少分通过。重中之重:哪怕你是背的题库,也请你一定不要直接抄原来的,最好是变更下方法名,否则会判定你重复率过高,从而失去后面的面试机会(实在是不会做再用此方法,凑分数所用,面试官能看到你的代码,会影响你的面试评价)本人女,所以还问道了婚育计划,有对象这点可以说,没有问题,但是如果可以的话,生孩子的时间,可以给hr说这几年不考虑。如果说没有难题,直接就挂了。

weixin_47767264的博客 5452

codeforces 1555A

A. PizzaForces PizzaForces is Petya’s favorite pizzeria. PizzaForces makes and sells pizzas of three sizes: small pizzas consist of 6 slices, medium ones consist of 8 slices, and large pizzas consist of 10 slices each. Baking them takes 15, 20 and 25 minu

Excers的博客 257

245. 项目195:简易文字冒险游戏——《跟老吕学Python·新手》

如果您在学习本专栏教程时遇到任何问题,或有任何技术交流的意愿,欢迎在文章评论区留言,或通过优快云私信与老吕取得联系。老吕将及时回复您的留言,并与您共同探讨,以期为大家提供更为精准和有效的帮助。老吕珍视每一位读者的反馈和支持,期待与您共同学习、共同进步,共同创造美好的未来!我们的目标是不仅教会您Python语言,更是培养您解决问题的思维方式。请随意翻阅,按照自己的节奏学习,让这本专栏成为您编程旅程中的可靠伙伴。开发一个简易的文字冒险游戏,通过文本描述场景和事件,让玩家通过选择不同的选项来推动故事发展。

Python老吕的博客 712

codeforces 1555 A. PizzaForces(思维)

contents:题意思路代码 题意 链接: link. 你要烤n块披萨 一整块的披萨有3种规模 6块的需要15min 8块的需要20min 10块的需要25min 问你需要最少时间烤完 思路 首先 15/6=2.5 20/8=2.5 25/10=2.5 所以性价比都一样 那么8和10存在的意义是什么 假设计划全烤6块的,最后可能会剩下不够6块的, 可能是0到5,再烤一份那就需要15min 如果你把计划中最后一整块换一种规模,每多两块披萨你上升一种规模,这样浪费的最少,时间自然最小,噢原来8和10的存在是为

MoRan0_0的博客 451

RK3588 MPP,RGA,DRM,QT之RGA

RK3588多路视频采用RGA来进行混合成一帧

dreamliweiming的博客 4265

在 TASKPROCESSING 上为 ABAP OData 服务添加多个系统别名:从原理到落地的完整实践

本文面向SAP Gateway与ABAP开发者,详细讲解如何在TASKPROCESSING OData服务上添加系统别名。首先介绍了系统别名的概念与设计初衷,阐述了添加别名的业务场景需求,包括多系统接入、用户分流和灰度发布等。随后提供了标准配置步骤,从SPRO路径到具体操作说明,并分享了三个实际案例说明如何实现跨区域统一待办、按用户角色分流和灰度发布。最后给出了验证方法和常见问题解决方案,帮助开发者掌握这项基础但关键的配置技能,实现服务路由的可控管理。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 137

CodeForces 1555A PizzaForces

A题 记录这道题的原因是,有人把这道题当做背包来做。 其实是不是背包可以简单先看看这点:6,8,10片的Pizza分别需要15,20,25分钟,但单片时间6/15 = 8/20 = 10/25。这种就不是一道背包。 n的数据范围很大,这种题只要在long long 范围内就还没有涉及到高精度,可以这么暴力处理: if (n>=100) { long long num=(n-100)/10; ans=num*25; n=n-num*10; } 把问题规模拿到100的范围,再

qq_42521237的博客 287

淘宝母婴用品数据挖掘及可视化分析研究

1. 背景介绍 在当今的电子商务时代,母婴用品市场已经成为了各大电商平台的一片蓝海。淘宝作为中国最大的电子商务平台,其上的母婴用品交易数据自然引人关注。理解这些数据,可以帮助商家更好地制定营销策略,也可以帮助消费者更好地选择产品。因此,本文将对淘宝母婴用品的数据进行深入的挖掘和分析。 1.1 电子商务的

AI天才研究院 1257

Educational Codeforces Round 112 (Rated for Div. 2)A,B,C题解(cf1555a-1555c)

Educational Codeforces Round 112 (Rated for Div. 2)A,B,C题解 A.PizzaForces A. PizzaForces time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output PizzaForces is Petya’s favorite pizzeria. PizzaForces makes an

二代咸鱼们的博客 341

老版QQ原生表情gif动态

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

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

Pizza Separation (暴力枚举)

LiMn2O4有一天在逸夫楼的FZ 131看门,到了中午他订了打卤馕外卖,没想到practer此时要和他抢打卤馕吃,怎么办呢?聪明的你需要想出一个方案,能让上面二位都满意,也就是他们分得的打卤馕大小的差最小 分的时候他们让LiMn2O4先从一块开始取连续的一部分(这些块是挨在一起的),剩下的留给practer 馕已经被切成了n块,每块有一个整数ai表示,ai代表这块打卤馕的在整个打卤馕占的角度...

WhileTrue 422

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

codeforces 解题报告 979A. Pizza, Pizza, Pizza!!! math

http://codeforces.com/contest/979/problem/A解题思路:1.总人数是朋友数n加上自己,就是n+12.总人数是奇数时,刀的切法就不能直线穿过整个披萨,所以答案就是n+1。举个例子,画个五角星就知道了3.总人数是偶数时,每一刀都可以将披萨多分两部分,答案就是(n+1)/2。举个例子,平均过圆心切三刀得六块披萨4.注意范围 n &lt; 1e185.坑点就是 n ...

三生锁链 594

Gleb And Pizza CodeForces - 842B

CodeForces - 842B 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main() { 5 int r,d,t; 6 double temp,x,y,z; 7 while(~scanf("%d %d",&r,&d)) { ...

weixin_30631587的博客 221

A. PizzaForces

题目:https://codeforces.com/contest/1555/problem/A PizzaForces is Petya’s favorite pizzeria. PizzaForces makes and sells pizzas of three sizes: small pizzas consist of 6 slices, medium ones consist of 8 slices, and large pizzas consist of 10 slices each. Bak

he_qingjun的博客 354

PizzaForces CodeForces - 1555A

Problem - 1555A - Codeforces题目大意:6块披萨要15分钟,8快20分钟,10块25分钟,给出人数,要求没人至少一块,问最短要多长时间思路:所有3种披萨都是1分钟2/5块,所以答案就是人数乘以5/2,向上取整......

ashbringer233的博客 269

Ordering Pizza CodeForces - 867C(贪心+优先队列)

Ordering Pizza CodeForces - 867C 题意:给出n个人和一张饼可以分成m份。接下来n行给出s,v1,v2。分别表示一个人想吃多少片,吃1的幸福度,和吃2的幸福度。 思路:一开始没有看懂怎么写,后来明白就是一个贪心问题,但是自己写的办法一直wa,官网老是崩掉,内心焦急。然后参考了别人的做法,比我的简洁。直接使用两个优先队列。一个存v1大的,一个存v2大的。最后比较...

DeathYmz的博客 714

PizzaForces(思维)

题目链接 大意: 有三种披萨:小披萨:6块,需要15分钟;中披萨:8块,需要20分钟;大披萨:10块,需要25分钟。 现在来了n个客人,每个人至少1块,至少需要多少分钟?(n<=1016n<=10^{16}n<=1016) 思考: 看起来好像完全背包,但是数据太大,不能这样做。 既然是完全背包的题,而且又不能用完全背包做,那就一定有这个题目独特的性质。需要利用这个性质来做。 我们发现,不管是小披萨,中披萨还是大披萨,每一块烘培所需要的时间都是2.5分钟! 所以一个数n,只要能用6,8,

Mr_dimple的博客 401

code forces————————————Gleb And Pizza 详解

ac代码:#include&lt;iostream&gt; #include&lt;stdio.h&gt; #include&lt;algorithm&gt; #include&lt;string.h&gt; #include&lt;math.h&gt; using namespace std; int d,r; long n; struct xi{ double x; double y; ...

runingpen的博客 273

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 - 735D - Taxes ( 哥德巴赫猜想 )
下一篇: CodeForces - 1549D - Integers Have Friends ( 差分 - 线段树 - 双指针 )
Cosmic_Tree
博客等级 码龄7年 134粉丝 337原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值