Codeforces Round #300 解题报告(ABCDEF)

Facebook Hacker Cup 2015 Round 1 解题报告 Homework         求一个区间[A,B]中素因数个数为K的数有多少个。做法是dp。对每个数i,找到它的某一个素因数d,i的结果就由i/d推得。找的方法是修改筛法。 #include #include #include #include #include #include #include #include #include using namespace 阅读详情

A Cutting Banner

        给一个串,从头尾各切一段下来(也可以不切),问头+尾能否组成"CODEFORCES"。对头尾进行匹配分别得到长度,然后长度相加看是否>=10。


B Quasi Binary

        给一个数,问这个数最少能用多少个只包含0和1的数相加得到,输出任意解(数都是十进制)。贪心,但是要注意,设当前还需要凑cur,不能去找最大的不超过cur的只含01的数。比如20,如果减去11,剩下部分还要9个1。。远不如10+10。正确做法是按位来看,如果某一位大于0,那么该位填1,否则填0。


C Tourist's Notes

        爬山,每天海拔只能和前一天一样或增减1。给出总共爬的天数,记录下了某些天的海拔,问最高可能到达海拔。和之前的一场CF的某题几乎一样。。设相邻两个记录相距d(i+1)-d(i)天,高度为h(i)和h(i+1),中间可到达最大高度就是(d(i+1)-d(i)+h(i)+h(i+1))/2。第一个记录前和最后一个记录后让它逐天递增1就好,找出最大。


D Weird Chess

        在n*n的棋盘上,有个(dx,dy)的集合,定义了当棋子在(x,y)可以跳到(x+dx,y+dy)。给出一个棋盘,上面放了若干棋子,标出了这些棋子能跳到的所有位置。现在(2*n-1)*(2*n-1)的棋盘中心有一枚棋子,要求在上面画出(dx,dy)集合(任意解)。

        我的做法是暴力。对每一个(dx,dy),用棋盘上所有棋子去验证这个(dx,dy)是否可行。


E Demiurges Play Again

        一棵树,有m个叶子,所有叶子标有号1~m。两个人轮流从根开始往下走,走到叶子结束。先手希望走到的叶子号尽可能大,后手希望尽可能小,两个人都是最优决策。问先手安排叶子号和后手安排叶子号时,走到的结果分别是什么。

        这题目出得好,我弄了很久才理解。首先假设树的所有叶子号我们都已经知道。定义MAX(u)是希望最大的人先手u为根的子树会走到的结果,MIN(u)是希望最小的人先手u为根的子树会走到的结果。vi是u的孩子,那么,MAX(u)就等于MIN(vi)中的最大值,MIN(u)就等于MAX(vi)中的最小值。

        但是,树的叶子号我们不知道(可以安排)。只考虑子树中每个叶子的相对大小,就是在子树中所有叶子的rank(从大到小依次1,2,3...)。记f(u)为希望最大的人先行动u子树得到的rank,g(u)为希望最小的人先行动u子树得到的rank。那么对于叶子有f(u)=g(u)=1,非叶子有f(u)=min(g(vi)),g(u)=sum(f(vi))。最后结果就是m-f(1)+1,g(1)(因为对称性)。

#include <bits/stdc++.h>
using namespace std;

const int maxn=2e5+10;
const int INF=1e9;

int n;
int head[maxn];
int pre[maxn];
int to[maxn];
int f[maxn];
int g[maxn];
int tote;

void addedge(int u,int v){
	to[tote]=v;
	pre[tote]=head[u];
	head[u]=tote++;
}


static int leafcnt=0;
void dfs(int u){
	f[u]=INF;
	for(int i=head[u];~i;i=pre[i]){
		int v=to[i];
		dfs(v);
		if(g[v]<f[u])f[u]=g[v];
		g[u]+=f[v];
	}
	if(!g[u]){
		leafcnt++;
		g[u]=f[u]=1;
	}
}


int main(){
	memset(head,-1,sizeof(head));
	tote=0;
	
	cin>>n;
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs(1);

	cout<<leafcnt-f[1]+1<<" "<<g[1]<<endl;
	return 0;
}



F A Heap of Heaps

        给一个n个元素的数组。问如果把这个数组当成k(k=1,2,3...n-1)叉堆(小顶堆),分别有多少个元素不合法。不合法是指节点小于自己的父节点。

        首先对于k叉堆,每个元素孩子在数组中的下标范围是可以用O(1)计算出来的。我们可以将这n个数从小到大排序,记录下每个元素原来的位置。从小到大将元素的位置加入到树状数组里(其实是先查询),并查询树状数组,自己孩子的那个区间内有多少比自己小的。注意一个细节,先查询完同样大小的所有元素,再更新树状数组。详见代码。

        值得一提的是复杂度。因为2叉树大致有n/2个节点有孩子,3叉树大致有n/3,4叉n/4...调和级数的和趋近于ln(n),而树状数组的操作复杂度是log(n)。因此,总复杂度是nlognlogn。。。

#include <bits/stdc++.h>

using namespace std;

const int maxn=2e5+10;
int n;
int a[maxn];
int rank[maxn];

bool cmp(int x,int y){
	return a[x]<a[y];
}

inline int Lmostson(int id,int k){
	return id*k-k+2;
}

inline int Rmostson(int id,int k){
	return id*k+1;
}

inline int lowbit(int x){
	return x&(-x);
}

int c[maxn]; 
void update(int pos){
	while(pos<=n){
		c[pos]++;
		pos+=lowbit(pos);
	}
}

int query(int pos){
	int re=0;
	while(pos){
		re+=c[pos];
		pos-=lowbit(pos);
	}
	return re;
}


int ans[maxn];

int main(){
	cin>>n;
	a[0]=-1e9-1;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	
	for(int i=0;i<=n;i++)rank[i]=i;
	
	sort(rank,rank+n+1,cmp);
	
	for(int rnk=1;rnk<=n;rnk++){	//枚举排第rnk位的数 
		int pos=rank[rnk];
		for(int k=1;k<n;k++){		//k叉树 
			int lson=Lmostson(pos,k);
			if(lson>n)break;		//没有孩子了,跳出 
			int rson=Rmostson(pos,k);
			if(rson>n)rson=n;
			//查询孩子中有多少个小于自己的
			int tmp=query(rson)-query(lson-1);
			ans[k]+=tmp;
		}
		//只有当下一个数不同才去更新 
		if(a[rank[rnk]]!=a[rank[rnk+1]]){
			int cur=rnk;
			while(1){
				update(rank[cur]);
				cur--;
				if(a[rank[cur]]!=a[rank[cur+1]])break;
			}
		}
	}
	for(int i=1;i<n;i++){
		printf("%d ",ans[i]);
	}
	return 0;
}




Nvidia AGX Xavier刷机指北 因为工作的关系,要在AGX上安装CUDA。nvidia官网上没找到适合AGX版本的CUDA,只能走刷机的路子。刷机过程中,也遇到一些坑,做个记录。 需要有一台ubuntu系统的电脑作为主机Host。我的主机系统为Ubuntu18.04 整个刷机过程为: 在Host上安装sdkmanager,整个刷机过程主要通过sdkmanager来操作。 在Host自动下载一些系统组件,各种deb包 Host上制作OS系统镜像,烧录到AGX中 Host上之前下载好的deb包,安装到AGX中。 完结,撒花 ... 阅读详情

相关推荐

【华为OD机试真题】7、字符串筛选排序 | 机试真题+思路参考+代码解析(C++、Java、Py)

题目描述 >输入一个由N个大小写字母组成的字符串 按照ASCII码值从小到大进行排序 查找字符串中第K个最小ASCII码值的字母(k>=1) 输出该字母所在字符串中的位置索引(字符串的第一个位置索引为0) k如果大于字符串长度则输出最大ASCII码值的字母所在字符串的位置索引 如果有重复字母则输出字母的最小位置索引

KJ.JK 2267

Codeforces Round #300 (A,B,C,D)

题目传送:Codeforces Round #300 A. Cutting Banner 思路:一看题就会错意了,然后一顿猛敲,果不其然的被hack了,然后才发现只需要剪中间那一段就可以了,然后又傻逼得少写一个等号,还是被hack了,心累啊 AC代码: #include #include #include #include #include #in

Never say never 1226

槽型光电开关传感器原理图设计,已量产(光电传感器)

在嵌入式设备的位置限位、物料计数等场景中,槽型光电开关是性价比极高的传感器方案 —— 它通过遮挡发射器与接收器之间的光路实现电平切换,电路简单且抗干扰性优于漫反射式光耦。今天分享一个实际项目中落地的槽型光电开关检测电路,从器件选型到逻辑设计都做了简化适配,适合小批量原型或低成本产品的需求。

不脱发的程序猿 719

Codeforces Round #300

第一次打CF,希望自己能坚持下去吧 A. Cutting Banner  水题 看错了题意,一个串一次只能切中间的一段,结果被HACK了= = #include #include #include #include #include using namespace std; string a,q; int main() { cin>>q; int j,l,i,f=0

sxy12138的专栏 399

【深度学习】脸部修复,CodeFormer,论文,实战

Blind face restoration是一个高度 ill-posed 的问题,通常需要辅助引导来 1) 改善从降级输入到期望输出的映射,或者 2) 补充在输入中丢失的高质量细节。在本文中,我们展示了在一个小的代理空间中学到的离散码本先验可以通过将盲目的面部恢复建模为 a code prediction task来大大减少恢复映射的不确定性和模糊性,同时为生成高质量面部提供丰富的视觉元素。

q742971636的博客 2994

成功解决AttributeError: ‘ImageDraw‘ object has no attribute ‘textsize‘

​ 成功解决AttributeError: 'ImageDraw' object has no attribute 'textsize' 目录 解决问题 解决思路 解决方法 解决问题 AttributeError: 'ImageDraw' object has no attribute 'textsize' 解决思路 属性错误:'ImageDraw'对象没有属性'textsize' 解决方法 最新的Pillow 10.0.0 版本已经删除了这个函数,导致两个库(Pillow 、wordc

头部AI社区如有邀博主AI主题演讲请私信—心比天高,仗剑走天涯,保持热爱,奔赴向梦想!低调,专注,谦虚,自律,反思,成长,还算比较正能量的博主,公益免费传播…内心特别想在AI界做出一些可以推进历史进程影响力的技术(兴趣使然,有点小情怀,也有点使命感呀 4780

Codeforces Round #300——A.B.C.D.E.F

http://codeforces.com/contest/538A. Cutting Banner 题目描述: 给你一个字符串,判断能否通过删除其中的某一个连续的字串,得到“CODEFORCES”这个字符串#include<bits/stdc++.h> using namespace std; int main() { string cf="CODEFORCES"; strin

fsdcyr 1152

【HALCON 25.11 + C#】 01:2026年工业机器视觉实战详解(从入门到精通)

2026年机器视觉市场规模将突破230亿美元,HALCON 25.11的革命性更新与C#的工业集成优势形成黄金技术栈。本文作为付费专栏开篇序章,聚焦“为什么现在必须学25.11+C#”的核心问题,通过真实工业案例、五项核心技术突破、联合编程架构优势及30篇系统学习路线,全方位论证其投资价值。读者将掌握持续学习、深度OCR加速等关键技能,获得可直接上产线的工业级代码资产与架构设计思维,解决柔性生产、边缘部署等核心痛点,成为具备技术溢价的机器视觉工程师。

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 1225

Codeforces Round #300(A.【字符串,多方法】,B.【思维题】,C.【贪心,数学】)

A. Cutting Banner time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output A large banner with word CODEFORCES...

weixin_33728268的博客 239

Trae 保姆级使用指南,零基础小白也能实现编程。

Trae 使用指南 Trae AI 使用 零基础编程 满血版 DeepSeek-R1&V3 AI IDE 深度理解中文开发场景 傻瓜式编程 编程入门 开发入门

Mr.L-OAM的博客 5818

Openclaw错误分析与解决方案之:All models are temporarily rate-limited. Please try again in a few minutes

Openclaw错误分析与解决方案之: All models are temporarily rate-limited. Please try again in a few minutes.

多媒体编程、网络编程、系统编程、网络安全编程、驱动编程 1619

Codeforces Round #300 A B C

A - Cutting Banner 给出一个字符串S,从中间删掉一部分子串T之后,剩下的S-T的串里面有没有“CODEFORCES”这个串。 string a = "CODEFORCES", b; int main() { while( cin >> b ) { bool f = 0; int len = b.length();

uuuuuu 565

[xboard-ok210] 44 s5pv210开发板介绍和对比

文章目录前言四大S3C6410提供商友坚开发板UT-S5PV210华天正(润尔)real210飞凌开发板ok210九鼎x210友善之臂开发板tiny210mini210smart210天嵌开发板tq210sate210xboardxboardxboard之ok210 前言 四大S3C6410提供商 友坚开发板 UT-S5PV210 华天正(润尔) real210 飞凌开发板 ok210 九鼎 x210 友善之臂开发板 tiny210 mini210 smart210 天嵌开发板 tq210 sate210

鹰之翔 286

Codeforces Round #300(E,F 树状数组)

F. A Heap of Heaps Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task a

龙崎的专栏 902

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Codeforces VK Cup 2016 - Round 1 (Div. 2 Edition)

A. Bear and Reverse Radewoosh  按要求计算一下即可。#include <bits/stdc++.h>#define ll long longusing namespace std;int p[111]; int t[111];int main(){ int n,c; cin>>n>>c; for(int i=1;i<=n;i++){

A Cube Master 2万+

假人有限元模型

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

河南省第七届ACM大学生程序设计竞赛 解题报告

这两天把去年省赛的题挂到了OJ上,顺便练手。 A.物资调度 DP,类似01背包。dp(i,j)表示情况数,第一维表示考察到第i种物资,第二维表示总数量为j。显然,如果按照题目给的数据范围,答案会超出64位整型的范围,但是题目并没有要求取模,只能说数据太弱。 B.海岛争霸 Floyd算法,稍微修改一下状态转移方程就可以了。Floyd是求和,这题是取最大。 C.机器人

A Cube Master 3360

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Google Code Jam 2015 Round 1A 解题报告

太弱了,比赛时只出了A的大数据和BC小数据,排到1700+。赛后才把B的小数据过了。 A. Mushroom Monster         就是贪心模拟。第一种吃法,只有当前时刻比10秒前少才去吃减少的量,否则不吃。第二种吃法,计算每十秒的减少量,以减少量最大的作为平均速率去吃。 #include using namespace std; int m[10010];

A Cube Master 2409

2015 百度之星初赛1 解题报告

1001 超级赛亚ACMer         贪心。首先击败战斗力不大于m的最强者,每次去找可以增强战斗力,然后能击败的最强者,把自己战斗力增加到和他一样去打。如果能打败最强的对手,就可以了。 1002 找连续数         离散化,离线按k从1~1000递增的顺序,维护以每个位置为起点长度为k的最小值,最大值,以及是否有相同数。如果MAX-MIN=k-1且没有相同数,长度为k的

A Cube Master 1794

2015 ICPC 长春网赛 解题报告

只A了几道水题,还好晋级了。 07 The Water Problem         果然是水题,随便模拟一下就好了。为了题解完整性贴出来。 #include #include #include #include #include #include using namespace std; int a[1010]; int main(){

A Cube Master 1463

福州大学第十二届程序设计竞赛 解题报告

由于这个OJ比较蛋疼,比赛时提交的代码看不到,所以就不附代码了,只说思路。 A 非提的救赎         待补。 B 完美的数字         求一个区间内,所有数的“完美度”的和,完美度定义为数i能分解为多少组i=A*A*B(A         预处理算出每个数的平方、立方。写一个函数fun(x)计算区间1~x的结果,题目的答案就是fun(b)-fun(a-1)。在

A Cube Master 1430

Google Code jam Qualification Round 2015 解题报告

Problem A. Standing Ovation         题目说的是有许多观众,每个观众有一定的羞涩值,只有现场站起来鼓掌的人数达到该值才会站起来鼓掌,问最少添加多少羞涩值任意的人,才能使所有人都站起来鼓掌。         贪心模拟一下就好,添加的人默认让他们羞涩值为0,扫一遍,让加到刚好够就行。 #include #include #include #includ

A Cube Master 1343

Codeforces Round #291 (Div. 2) 解题报告 (A B C D)

A Chewbaсca and Number         贪心,每一位取t和9-t中较小的。注意首位不能为0。 #include #include #include #include #include #include #include #include #include #include using namespace

A Cube Master 1178

2012 ACM-ICPC 杭州站解题报告(4道签到题)

hdu 4461 The Power of Xiangqi         题意:

A Cube Master 1153

Codeforces Round #301 (Div. 2) 解题报告(ABCD)

A Combination Lock         n位0~9密码锁两种状态之间,问最少拨多少次。注意可能越过'0'。直接上代码。。 #include using namespace std; char num1[1010]; char num2[1010]; int main(){ int n; cin>>n; cin>>num1>>num2; int ans=0;

A Cube Master 1096

Codeforces Round #273 (Div. 2) 解题报告 (A B C D)

A. Initial Bet

A Cube Master 1047
上一篇: poj 1422 Air Raid
下一篇: Codeforces Round #301 (Div. 2) 解题报告(ABCD)
squee_spoon
博客等级 码龄14年 61粉丝 455原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值