HDOJ学习笔记(一)

HDOJ课程例题全解析:从判题原理到算法思维训练指南 在线评测系统(OJ)是算法学习与编程实践的核心工具,通过自动判题机制对代码进行黑盒测试,并返回AC、WA、TLE等结果,帮助开发者精确识别问题所在。其背后蕴含的输入输出规范、边界条件处理、复杂度优化等原理,是构建扎实编程能力的基础。在高校计算机教育和算法竞赛训练中,OJ平台被广泛用于C语言教学、数据结构练习及算法专题突破。本文以HDOJ(杭州电子科技大学Online Judge)经典课程例题为切入点,系统梳理A+B Problem、循环求和、快速幂、贪心算法、递推数列等典型题目的解题思路与代码实现,并总结W 阅读详情

原创文章,版权归www.encalyk.com所有,转载请注明。

第一阶段,做了如下训练。
任务一、了解HDOJ系统(acm.hdu.edu.cn),看完F.A.Q,注册Forum账号,熟悉各栏目代表的意思。
任务二、学会自主练习题目。不懂的地方,知道在哪、如何讨论。
任务三、完成了HDOJ Problem Index by Type(Introduction)所有题目。

C++AC答案(答案可以是多种多样,下面只作为参考)

1000
#include<iostream>
using namespace std;
int main()
{
 int a,b;
 while(cin >>a >>b)
 cout << a+b <<endl;
 return 0;
}

1001
#include<iostream>
using namespace std;
int main()
{
 int i,n,sum;
 while(cin >> n)
 {
  sum=0;
  for(i=1;i<=n;i++)
   sum=sum+i;
  cout << sum << endl << endl;
 }
 return 0;
}

1089
#include <iostream>
using namespace std;
int main()
{
 int a,b;
 while(cin >> a >>b)
 cout << a+b << endl;
 return 0;
}

1090
#include <iostream>
using namespace std;
int main()
{
 int N,i,a,b;
 cin >> N;
 for(i=0;i<N;i++)
 {
  cin >>a >>b;
  cout << a+b << endl;
 }
 return 0;
}

1091
#include <iostream>
using namespace std;
int main()
{
 int a,b;
 while((cin >> a >> b) && (a!=0 || b!=0))
  cout << a+b <<endl;
 return 0;
}

1092
#include <iostream>
using namespace std;
int main()
{
 int N,i,a,sum;
 while((cin >> N) && (N!=0))
 {
  sum=0;
  for(i=0;i<N;i++)
  {
   cin >>a;
   sum+=a;
  }
  cout << sum << endl;
 }
 return 0;
}

1093
#include <iostream>
using namespace std;
int main()
{
 int N,M;
 cin >>N;
 int i,sum,j,a;
 for(i=0;i<N;i++)
 {
  sum=0;
  cin >>M;
  for(j=0;j<M;j++)
  {
   cin >>a;
   sum+=a;
  }
  cout <<sum << endl;
 }
 return 0;
}

1094
#include <iostream>
using namespace std;
int main()
{
 int N,sum,a,i;
 while(cin >>N)
 {
  sum=0;
  for(i=0;i<N;i++)
  {
   cin >>a;
   sum+=a;
  }
  cout << sum << endl;
 }
 return 0;
}

1095
#include <iostream>
using namespace std;
int main()
{
 int a,b;
 while(cin >> a >> b)
  cout << a+b << endl <<endl;
 return 0;
}

1096
#include <iostream>
using namespace std;
int main()
{
 int N,M,i,j,sum,a;
 cin >>N;
 for(i=0;i<N;i++)
 {
  sum=0;
  cin >>M;
  for(j=0;j<M;j++)
  {
   cin >>a;
   sum+=a;
  }
  if (i==N-1)
   cout << sum << endl;
  else
   cout << sum << endl << endl;
 }
 return 0;
}

1161
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
 char str[1000];
 while(cin.getline(str,1000))
  cout << strlwr(str) << endl;
 return 0;
}

1406

#include <iostream>

using namespace std;

int main()

{

int num1,num2,n,sum1,sum2,i;

cin >> n;

while(n–)

{

sum2=0;

cin >> num1 >> num2;

if(num1>num2)

{

int temp;

temp=num1;

num1=num2;

num2=temp;

}

for(;num1<=num2;num1++)

{

sum1=0;

for(i=1;i<num1;i++)

if(0==num1%i)sum1=sum1+i;

if(sum1==num1)sum2++;

}

cout << sum2<<endl;

}

return 0;

}

hdoj刷题经验总结(持续更新ing) (语言采用c++)1、输出如何保留两位小数#include&lt;iostream&gt;#include&lt;iomanip&gt;using namespace std;void main(){float result=2.355; printf("%.2f\n",result); //C语言的表达方式,.n表示保留n位小数,并且四舍五入cout&lt;&lt;setprecision(2)... 阅读详情

相关推荐

HDOJ 十天刷题及答案 c++

HDOJ10天刷题顺序 每天四五道(1.1代表第一天第一道),从易到难 分享一下我的结果,都AC了,欢迎提意见哦~ 文章目录1.1.HDOJ 10001.2.HDOJ 10891.3.HDOJ10961.4.HDOJ10011.5.HDOJ 20002.1 HDOJ 20012.2 HDOJ 20022.3 HDOJ2003绝对值2.4 HDOJ 2004 成绩转换2.5HDOJ20053.1 H...

qq_39814753的博客 3019

HDOJ初体验

HDOJ的使用 1.0 什么是HDOJ HDOJ 是“杭州电子科技大学程序在线评测系统”(Hangzhou Dianzi University Online Judge)的缩写,是一个提供编程题目以及在线测评的网站,其兼容Pascal、C、C++、Java、GCC、G++等多种语言,并拥有良好的运行速度和很高的测评正确率。HDOJ入口 2.0 如何去使用HDOJ 2.1首先注册一个账号...

ww921703959的博客 1万+

HDOJ 1010 解题

在回顾搜索算法,DFS、BFS、回溯等。以HDOJ 1010题练习,虽然题目非常简单,但还是花了较长时间才AC。一开始没有剪枝,果断超时。进行了奇偶剪枝后ac。 //奇偶剪枝:如果起点横纵坐标和与终点坐标和奇偶性不同,则说明要走奇数步,如果要求走t步, //t为偶数,则肯定不可能有答案;反之亦然。 #include #include using namespace

sailtoy的专栏 1897

HDOJ(航电)题目分类大全

杭电里面有很多题目,如果你需要从简单的做起或者专注与某一类题目,可以从这里开始 基础题: 1000、1001、1004、1005、1008、1012、1013、1014、1017、1019、1021、1028、1029、1032、1037、1040、1048、1056、1058、1061、1070、1076、1089、1090、1091、1092、1093、1094、1095、

BarryLee的博客 4540

OJ.tar.gz_HDOJ _OJ源码_oj

codj,hdoj的源码(50-60题)

手把手教你用Matlab/Simulink搭建PMSM的SMO无感FOC仿真(附相位补偿与离散化代码)

本文详细介绍了基于滑模观测器(SMO)的永磁同步电机(PMSM)无传感器FOC控制方法,通过Matlab/Simulink平台实现从理论到实践的完整流程。内容涵盖SMO核心原理、离散化处理、转子位置估算与相位补偿技术,以及双闭环控制系统搭建,为工程师提供了一套完整的无传感器控制解决方案。

weixin_27038245的博客 258

HDOJ2089

懂了简单模板之后用起来就是舒服,跟着题目的数值和条件改一改就能过 题目链接:HDOJ2089 题目是不要62或者4出现,HDOJ3555是需要49出现,这有什么本质区别吗? 拿着代码改一改就好了 同样的,细节见代码哦 #include #include #include #include #include #include #include #include #include

ACdream 1268

【Unity】制作简易三维场景

本文介绍如何制作一个三维场景

CiNian_的博客 5338

HDOJ 1060 / HDOJ 1061/ HDOJ 1568 总结(如何求大数最左边最右边的数)

HDOJ 1060 / HDOJ 1568 这种题目就是再说一个问题:如何求一个大数num的最左边的一个或几个数字?      其实这两题的解法都是一样的,给定一个num(当num大到无法用int或long long储存时可以直接用lg num储存它),num = 10 ^ n * a. n为num的位数-1 , a为小于10的一个实数..   比如27 = 10 ^ 1 * 2.7   所

Zenny 1040

Ecg信号QRS波峰检测:A Real-Time QRS Detection Algorithm (Pan-Tompkins法)

Pan-Tompkins法是R峰检测的经典方法,被引量高达6000+次。 Pan J, Tompkins W J. A real-time QRS detection algorithm[J]. IEEE transactions on biomedical engineering, 1985 (3): 230-236. 本文对论文流程进行了总结,并参考BioSigKit项目,复现了论文代码。 流程图: 代码如下: 第一部分是信号读入,这里使用MIT_BIH信号的100,读入10000个数据点 第二部分

weixin_42870380的博客 1万+

STM32F103C8T6 + GY-906红外测温:手把手教你用CubeMX和HAL库搞定IIC驱动(附完整工程)

本文详细介绍了如何使用STM32F103C8T6和GY-906红外测温传感器(基于MLX90614芯片)实现非接触式温度测量。从STM32CubeMX工程创建、HAL库驱动适配到温度数据采集与处理,提供完整的开发流程和常见问题解决方案,帮助开发者快速掌握红外测温技术。

weixin_29188043的博客 258

hdoj1003解法

这道题就是寻找最优子结构的问题 一开始我的代码是这样的: #include void main(){ int arr[100002],num,count,sign=0,i,j,sum,x,y,b; scanf("%d",&count); while(count--){ scanf("%d",&num); for(i=1;i<=num;i++){

lwl13207136100的博客 1418

深度学习的unfold操作

对于彩色图像这样的三维数据,unfold操作会对每个通道分别进行上述的二维展开操作。例如,一个 RGB 图像,在对其进行unfold操作时,红色通道、绿色通道和蓝色通道的数据都会被独立地按照定义的窗口和步长展开,然后将这些展开后的通道数据按照原来的通道顺序组合在一起,形成新的张量。与我们熟悉的卷积类似,unfold也是使用一个特定大小的窗口和步长自左至右、自上至下滑动,不同的是,卷是滑动后与核求乘积(所以取名为卷积),而unfold滑动后不求乘积,是将窗口内的数据展开。

xulibo5828的博客 2175

递推——HDOJ 2048&&2049

接着前一篇日志,两道递推题目,主要都是错排公式的运用 HDOJ 2048 神、上帝、老天爷 /* HDOJ 2048 先用错排公式求出对应的错排总数,然后再求下对应的百分比 */ #include _int64 fac(int n) { if((n == 1) || (n == 0)) return 1; else return (n*fac(n-1)); } int m

Kay's space 1169

【第2章>第10节】深度学习DenseNet模型分析与matlab仿真

本文介绍了基于DenseNet深度学习模型的图像分类MATLAB实现方法。主要内容包括:1. DenseNet模型原理,详细解析了初始卷积层、密集块、过渡层等核心结构;2. 在MATLAB环境下完成DenseNet工具箱安装和测试样本准备;3. 实现图像预处理(统一缩放为224×224)、模型训练和测试的完整流程;4. 提供了混淆矩阵和准确率等测试结果分析。文章附带完整的MATLAB程序代码和操作视频教程,适合深度学习初学者快速掌握DenseNet模型的图像分类应用。通过实际测试,验证了该方案的有效性。

FPGA/MATLAB学习教程/源码/项目合作开发 333

Yocto系列讲解[入门篇] 1 - 快速入门熟悉Yocto的构建

yocto quick start up带大家快速上手

fulinux的博客 5万+

HDOJ的入门级水题

我只想说,它不光是水题,还是入门级水题。 做得那个爽啊,7道题只需要10分钟。。。 算了,没啥好现的。 学了C的都会做。。。 =。= 1.输入多个,以EOF为结束标志。 HDOJ 1089 while(scanf(“%d %d”, &a, &b) != EOF) 注:EOF是一个预定义的量,值是-1 2.输入N个 ...

weixin_30468137的博客 327

Dify使用教程3:Dify创建工作流

Dify使用教程3:Dify创建工作流 接着,我们连接下一个节点:“LLM”填入上下文变量为:result。这时候知识库就添加成功了。添加新节点:结束节点。

拥抱具身智能,昇腾Ascend C 5142

HDOJ C#指南

之前HDOJ上线C#的时候,特地为此写了一个说明。 不过然后这个功能并没有用,也就留在题库里,DIY/Web DIY/ STD Contest等全部没上线对此的支持,说明也没上。 然后今天整理硬盘的时候发现这个,于是贴到这里来了(做个备份)。 (当时写的是英文版,今天懒得翻译了233333)Since 11 March 2015, the C# programming language is

HDU_toraoh 2110

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

并查集——HDOJ 1272

HDOJ 1272 小希的迷宫 /* HDOJ 1272 并查集的基本运用。 符合要求的情况是: 1、图是一个无环的图 2、图是连通图 特别注意,如果一开始就输入 0 0 是符合要求的 */ #include using namespace std; int p[100001]; //p[x]是x的父亲 int rank[100001]; //rank[x]是x的秩 int Fin

Kay's space 1006

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

入门字典树 HDOJ1251 统计难题 HDOJ1075 字典翻译

HDOJ 1251 统计难题 最简单的字典树,耗内存,对比一下C++和G++下相同的代码运行结果: G++虽然快点,但是直接MLE...所以交的时候还要注意选择编译器啊 #include #include #include #include #include #include #define mst(a,b) memset(a,b,sizeof(a)) using namespace

AgoniAngel 747

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

差分约束——HDOJ 1529

HDOJ 1529 Cashier Employment 断断续续做了3天才弄明白,真是一道经典题 /* HDOJ 1529 Cashier Employment s[i]保存从24时刻开始到i时刻的雇佣人数 t[i]保存i时刻能够上班的人数 r[i]保存i时刻至少需要的人数 只要开始工作就要连续工作8小时,有下面的约束条件 0 <= s[i]-s[i-1] <= t[i] s[i]-s[

Kay's space 1003

HDOJ1004

最近才有意识地开始刷HDOJ上的题目,先从水题开始练手,比如说1004。 该题目的意思很简单,第一行输入气球的个数n,以下n行输入n个气球的颜色,n为0时输入结束,要求输出哪种颜色的气球颜色最多。 这题是很简单,也用不到什么算法的东西,就是对输入的字符串进行比较和统计。 看到题的第一想法很简单,先抛开问题,先对输入的格式做一个尝试,就是对输入的结果进行遍历输出,呵呵,最初的尝试就折腾了很久,也

面目全非,胸有丘壑 | Json Lee 2577

并查集——HDOJ 1213

HDOJ 1213 How Many Tables /* HDOJ 1213 并查集的基本运用,求集合数 */ #include using namespace std; int rank[1001]; //元素的秩 int p[1001]; //元素的父亲 int Find(int x) { int root,y,w; y=p[x]; while(p[y] != y) {

Kay's space 947

HDOJ试水心酸总结

下面是一些被HDOJ玩弄的痛苦教训(低级错误和各种规范) 1.scanf("",&); &符号不要忘 2.输出格式要注意啊!printf里面要跟上\n!!! 3.若有多轮,则要注意做完一轮之后所有数据初始化!!!!! 4.scanf字符串的时候,直接scanf("%s",a); 而不是scanf("%s",&a[i]); 5.scanf("%lf");与scanf("%.2lf");不一样,尽量用前者 Q:指针为什么要动态空间?(是因为指针无所指!!) 因为它所指的地址

qq_49666427的博客 714

Greedy——HDOJ 2037

HDOJ2037题目描述 和前面写的那篇活动安排的贪心算法是一个模式的,那一篇是按照活动的结束时间升序排序做,这道题也可以那样做,但是我改了一下,用开始时间做降序排序来做,刚好算法导论有一道类似这样的练习题,所以就做了,思想是差不多的。 //和活动安排是一类题目 //HDOJ2037 #include #include using namespace std; struct TV

Kay's space 983
上一篇: 我的七个建议【作者:Joel Spolsky】
下一篇: HDOJ学习笔记(二)
Encal
博客等级 码龄16年 1粉丝 31原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值