hdu 1050 Moving Tables(排序方法小结。贪心)

【人工智能AI】是什么? 人工智能(Artificial Intelligence),英文缩写为AI。它是研究、开发用于模拟延伸和扩展人的智能的理论方法技术及应用系统的一门新的技术科学。(百度百科)人工智能的基本原理:机器从「特定的」大量数据中总结规律,形成某些「特定的知识」,然后将这种「知识」应用到现实场景中去解决实际问题。在这个基本原理的基础上,有3个特征:1、人工智能本质上是一种工具2、人工智能技能只能解决特定的问题,而不是什么都能做3、人工智能属于归纳逻辑,可以告诉你是什么,但是不能告诉你为什么。 阅读详情

 

Problem Description

The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. 



The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its system. The reform includes moving a lot of tables between rooms. Because the corridor is narrow and all the tables are big, only one table can pass through the corridor. Some plan is needed to make the moving efficient. The manager figured out the following plan: Moving a table from a room to another room can be done within 10 minutes. When moving a table from room i to room j, the part of the corridor between the front of room i and the front of room j is used. So, during each 10 minutes, several moving between two rooms not sharing the same part of the corridor will be done simultaneously. To make it clear the manager illustrated the possible cases and impossible cases of simultaneous moving. 



For each room, at most one table will be either moved in or moved out. Now, the manager seeks out a method to minimize the time to move all the tables. Your job is to write a program to solve the manager’s problem.

 

 

Input

The input consists of T test cases. The number of test cases ) (T is given in the first line of the input. Each test case begins with a line containing an integer N , 1<=N<=200 , that represents the number of tables to move. Each of the following N lines contains two positive integers s and t, representing that a table is to move from room number s to room number t (each room number appears at most once in the N lines). From the N+3-rd line, the remaining test cases are listed in the same manner as above.

 

 

Output

The output should contain the minimum time in minutes to complete the moving, one per line.

 

 

Sample Input


 

3 4 10 20 30 40 50 60 70 80 2 1 3 2 200 3 10 100 20 80 30 50

 

 

Sample Output


 

10 20 30

 

题目意思:2间对面房公用一条道,若两次活动有道重叠则要分开进行,求一共要进行多少次。

解题方案:                              A    暴力(简单)

       无公用则可同时进行,所以只要求出哪一条道经过次数最多,那就是最大答案。

                                               B   贪心

   设置标记(1数组 2改数据,以下改数据方法),排序后,枚举判断是否有重叠部分,没有则同时进行并标记。

   意思就是搞定所有方案要运行几次,每运行一次ans++,记录运行了几次,最后输出答案。

  

注意点:  输入的两个数不一定前面那个比较小,输入要处理,暴力的话还要减1除2,求出第几条道。

              贪心解法要注意1:以开始还是以结尾排序?        2:以不同排序方法以正序还是倒序枚举

为什么以头排序或者以尾排序要不同的比较顺序呢,这里也卡了我几次,可以说是很严重的思想问题

从一些简单的数据看不出自己的错误,后来也是通过数据看出区别。

  1:以结束时间做排序,运行的时候倒序枚举求最多数量,因为正序求得是最长的链接,会存在非最优匹配。

  2:以开始时间做排序,正序枚举求最多,倒序枚举求最长。

  什么是求最多? 就是能够接在别人后面的样例的数量(多条加起来的数量)

  什么是最长连接? 就是一条链上的样例数量最多(一条的数量)

很难说,下面举个例子。下面是一个数据,已经经过结束时间做排序,然后正序枚举求答案。

14 42
17 100
98 104    (98>42)接上第一个 1
19 112
61 116
84 140
36 143
75 154
125 158   (125>104) 接上第三个 3
66 163
53 165
81 168
15 170
21 171
48 176
3 189
151 195   接上第二个2
65 196
105 199  (这个被前面的抢先了,本来两个都可以的)
这样才是最优
17 100 -〉105 199
19 122 -〉151 195 
但是以尾来排,能找到最长,但是可能存在尾比较小,这样他优先,到后面尾巴变大了,却接不上了,
17 100 -〉151 195 (195<199他先接)
19 122 -〉105 199 (接不上了)(不Ok,比较小的结尾被抢了,导致到它时已经没有能匹配的尾)    
以开头来排序,不用担心被抢,因为开头递增,你能接我也能接,正序没错。

所以不同的排序方法,在匹配的顺序也要做出调整,要知道目标,知道怎样最优。

下面附上两种解决方案的代码:    A  暴力

 

#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
    int cas,ma,n,a,b,ans[200],kai,jie,i;
    cin>>cas;
    while(cas--)
    {
        ma=0;
        memset(ans,0,sizeof(ans));
        cin>>n;
        for(i=0;i<n;i++)
        {
        cin>>a>>b;
        if(a<b)
        {
            kai=(a-1)/2;
            jie=(b-1)/2;
        }
        else
        {
            kai=(b-1)/2;
            jie=(a-1)/2;
        }
        for(;kai<=jie;kai++)
        {
            ans[kai]++;
            if(ans[kai]>ma)
                ma=ans[kai];
        }
        }
        cout<<ma*10<<endl;
    }
    return 0;
}

                                                                       B 贪心

#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <map>
using namespace std;
struct fangjian
{
    long long int kai;
    long long int jie;
}fj[5000];
int cmp(fangjian a,fangjian b)
{
    if(a.jie<b.jie)
        return 1;
    return 0;
}
int main()
{
    long long int cas,n,i,j,a,b,en,ans;
    cin>>cas;
    while(cas--)
    {
        ans=0;
          cin>>n;
          for(i=0;i<n;i++)
          {
              cin>>a>>b;
              if(a<b)
              {
                  fj[i].kai=a;
                  fj[i].jie=b;
              }
              else
              {
                   fj[i].kai=b;
                  fj[i].jie=a;
              }
          }
          sort(fj,fj+n,cmp);
          en=fj[0].jie;
          for(i=n-1;i>=0;i--)
          {
              if(fj[i].kai==-1&&fj[i].jie==-1)
                continue;
                en=fj[i].kai;
              ans++;
              for(j=i-1;j>=0;j--)
              {
                  if(fj[j].kai==-1&&fj[j].jie==-1)
                    continue;
                  if(fj[j].jie%2==1)//单数
                  {
                      if(en-fj[j].jie>=2)
                      {
                          en=fj[j].kai;
                          fj[j].jie=-1;
                          fj[j].kai=-1;
                      }
                  }
                  else if(en-fj[j].jie>=1)
                  {
                         en=fj[j].kai;
                          fj[j].jie=-1;
                          fj[j].kai=-1;
                  }
              }
          }
          cout<<ans*10<<endl;
    }
    return 0;
}

 

 

 

 

 

 

 

AI编程工具到底是初学者的绊脚石还是垫脚石? 现在是AI时代,我们要做的,是学会拥抱AI、使用AI,成为AI的驾驭者,如果你因为害怕使用AI学不到东西,那么大可不必,因为AI必然是今后的趋势,相信会用AI在今后的求职面试中也会有很大的占比。另外我之前写了多篇有关AI编程开发工具Trae的使用技巧和教程,需要的话你可以关注公众号后通过菜单栏获取。另外我也把所有Trae相关的文章整合到了腾讯ima知识库,感兴趣的可以关注公众号以后回复。 阅读详情

相关推荐

机器视觉:9点标定的原理与实现

标定就是将机器视觉处理得到的像素坐标转换成实际项目中使用到的毫米坐标。简单说即使看看实际单位距离内有几个像素,如下图所示,10mm的距离内有222个像素,那像素坐标和实际的毫米坐标就有个比例关系了。

m0_49968063的博客 1万+

hdu-1050 Moving Tables(贪心法)

Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 52571 Accepted Submission(s): 17125 Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a build

weixin_47750287的博客 437

一分钟教会你搭建steam新游幻兽帕鲁服务器

总结: 游戏对服务器搭建要求相对较高、且对服务器网络协议有要求不能封堵UDP、多开、游戏运行久、同时在线人数多了这些会很吃内存 我自己用的64G内存多开4区测试玩家同时在线50多人的情况下内存已经跑满了、对于想用服务器搭建联机的小伙伴建议根据开区数量以及玩家人数去选择配置、当然也可以直接找我阿杰购买、我可以提供技术搭建服务。注:如果用的是本地电脑局域网搭建直接输入127.0.0.1:8211就行 如果用的是服务器搭建输入自己服务器IP+端口或解析的域名+端口进入游戏。

用最简单的方式说最重要的事!服务器、存储、云计 算、A智能的大数据产品、游戏开发技术。致力于广 大开发者、政企用户、各项机构等,构建云上世界提供全方位云计算解决方案。旨在打造差异化的开放式闭环生态系统帮助用户快速构建稳定、安全的云计算环境。 2235

HDU--1050:Moving Tables (贪心)

1. 题目源地址:http://acm.hdu.edu.cn/showproblem.php?pid=1050 2. 解题思路:         将每个输入的起始房间和

酒酿小圆子呀~ 813

STM32 ADC精准采集12V电池电压:从分压电路到软件校准全解析

本文详细解析了STM32 ADC精准采集12V电池电压的全过程,涵盖分压电路设计、电阻选型、ADC配置优化及软件校准方法。针对电池电压监测中的噪声、温漂等挑战,提供了硬件滤波与软件过采样等实战技巧,确保测量精度达到1%以内,满足嵌入式设备对电源管理的严苛要求。

tech5的博客 1013

基于射频技术的校园无人超市管理系统_360

本设计实现了一种基于射频技术的校园无人超市管理系统,系统集成了环境监测与商品管理两大核心模块。在环境监测部分,采用DHT11温湿度传感器与MQ2烟雾传感器对超市内部环境进行实时监测,结合温控与报警机制,实现自动通风与烟雾报警功能,并通过1.44寸SPI LCD显示屏进行本地信息显示。商品管理部分基于RC522-RFID读卡器完成商品识别,结合Qt上位机软件实现顾客自助选购与结算,同时支持管理员进行商品入库与会员卡管理等操作。系统采用STM32F103RCT6为主控核心,结合串口通信方式与Qt开发的上位机进行

375

HDU-1050——Moving Tables

                                            Moving Tables Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure...

K.X的博客 304

【实现100个unity特效之4】Unity ShaderGraph使用教程与各种特效案例(2023/12/1更新)

ShaderGraph是Unity中的一个可视化工具,用于创建和编辑图形着色器。其意义在于简化编写复杂着色器的过程,减少对具体编程语言的依赖,使艺术家和设计师可以更方便地创建各种美术效果。使用ShaderGraph可以通过图形界面设置着色器属性,包括颜色、纹理、光照等,并在视窗预览中即时显示结果,从而快速迭代和调整着色器。使用ShaderGraph需要先安装Unity 2018.1或以上版本,并添加ShaderGraph插件。打开ShaderGraph面板后,可以通过拖放节点并连接它们来创建着色器。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 4万+

HDOJ_1050 Moving Tables 解题报告

Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.  The floor has 200 rooms each on the north sid

xxm137164869的专栏 2024

主成分分析(PCA)简洁高效MATLAB实现详解

本文介绍了一个简洁高效的PCA算法实现。该实现通过SVD分解计算主成分,避免了显式协方差矩阵计算,支持两种降维方式:固定维度或按能量比例自动选择。核心步骤包括数据中心化、SVD分解和维度选择,代码量少但功能完整,适用于数据预处理、降维和特征提取等任务。实现中考虑了稀疏矩阵转换、默认参数处理等细节,可直接应用于MATLAB环境。

m0_62153576的博客 63

无人机——电机篇(一)

1. 电机的定义 电机俗称“马达”,是无人机的动力来源,无人机通过改变电机的转速来改变无人机的飞行状态。即改变每个电机的速度,使得无人机能够盘旋空中,上升或下降,或向各个方向移动。2. 电机的分类 电机分为:“无刷电机”和“有刷电机” - 无刷电机:是采用半导体开关器件来实现电子换向,具有可靠性高、低干扰、低噪声低、寿命长等优点。一般应用在稍大型的飞行器,载重大,可以有更广泛的用途。 - 有刷电机:是内含电刷装置的将电能转换成机械能(电动机)或将机械能转换成电能(发电机)的旋转电机。有刷电机是所有电机的基

weixin_46066938的博客 1万+

HDU_1050 重叠数

先将数组进行排序,第一次循环,将不重叠的元素从数组中删除(这里将flag赋值为false),sum+=10继续第二次循环,以此类推,直到数组中没有元素(flag全为false)#include #include #include using namespace std; struct move{ public: int start; int end; bool flag; }; bool comp( move p, move q){ return p.s

格物致知 941

如何将 Fiori Elements Object Page Header 工具栏里按钮用 JavaScript 代码设置成禁用状态

本文介绍了如何在SAP Fiori Elements应用中动态控制Object Page工具栏按钮的可用状态。通过UI5 Inspector工具分析发现,这些按钮的enabled属性都双向绑定到/ui/enabled模型字段。在StatusExt.controller.js中,通过获取按钮ID前缀拼接完整控件ID,使用setEnabled(false)方法即可禁用按钮。关键点包括:1)使用extensionAPI获取视图ID前缀;2)注意事件回调中的this上下文绑定;3)通过修改模型字段可同步更新所有绑定

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

ACM-贪心之Moving Tables——hdu1050

Moving Tables Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each

继续激情,继续奋斗。 3757

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

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

hdu 1050 Moving Tables

http://acm.hdu.edu.cn/showproblem.php?pid=1050 这个题我首先直接用的常规贪心,用的和那个尽可能看更多完整节目那种思路。但是。。。。。。。一直WA。。。。T_T。。。。 后来在网上搜了一下这个题,发现好多人都有问题,都没有求出来,基本上都用的对尾部排序求的方法。 其实这个题因为是两排走廊,所以1和2公用一个走廊,其中一个在需要移动的时候

蚕豆儿 781

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

HDOJ 1050 Moving Tables 【贪心】

HDOJ 1050 Moving Tables 【贪心】 题目链接 acm.hdu.edu.cn/showproblem.php?pid=1050 这个题是根据贪心训练所以写的贪心 但是有一种更简单的求法就是求最大重复区间: 【将走廊分成200块,每次输入后就对涉及到的走廊+1 最后输出这些数组里最大的数*10就可以了】 上面这种写法比较简单,不贴代码了 贪心的话首先

... 343

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

HDOJ 1050 Moving Tables(贪心&&灵活)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1050 题目大意:从房间i移到到房间j,在移动过程中,走廊i-j这一个部分被占用。只要不共用走廊的移动都可同时进行,每移动一次需要10分钟。 题目分析: 1.注意房间构造,奇数房间在上面,偶数房间在下面,但是相对的房间占用同一个走廊。所以我们把房间都转换为同一边。 room=(room+1)/...

Syy 224

贪心算法——Hdu 1050 Moving Tables

Moving Tables Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 12304    Accepted Submission(s): 4226 Problem Description The famous

Vector 1万+

(贪心)hdu 1050 Moving Tables

题目: hdu1050 题意: 有一个房间分布: 需要把桌子从room x 移动到 room y,在移动期间内连着room x 到 room y 的走廊将被无法使用(即这个区间内不能移动另一个桌子),移动一次桌子要10分钟。 说明了同时移动的可能情况和不可能发生的情况: 输出中应包含完成移动的最短时间(以分钟为单位)。 思路: 因为这个不是一个一维的问题,所以要把room x 到 room y 转化成 走廊 x‘ 到 走廊 y’,如下图所示: 要分两次走的情况:(room1 to room4) and

ymxyld的博客 209

贪心 hdu1050 Moving Tables

题意:从一个房间把桌子搬运到另一个房间,需要10分钟,且中间的走廊在这10分钟内不能被别人使用 现在有许多条桌子要搬送,问最少需要多少时间 很容易想到贪心,某个点,被区间覆盖的次数最多的,就是最长需要的时间 但是这题有陷阱,因为并没有说明每次给的两个数字,前一个会小于后一个 所以可能后前一个会大于后一个,所以在读入的时候可能要交换左右的大小 #include #inclu

qwb的博客 881

Moving Tables HDU - 1050 贪心

The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each on the north side and south side along the corridor. Recently the Company made a plan to reform its syst

Adrian099的博客 241

HDU 1050 Moving Tables(贪心)

Moving Tables Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.The floor has 200 rooms each on the n...

aadu4709的博客 158

HDU 1050 Moving Tables(贪心)

Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 46810 Accepted Submission(s): 15200 Problem Description The famous ACM (Advanc...

NJU phd 在读。 531

hdu 1050 Moving Tables(贪心)

题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1050 经典的贪心算法 有两点要注意的 第一点:按照开始的时间排序,开始的时候用结束时间来排序,结果确实不对,有些数据通不过,例如: 4 10  30 15 50 60 70 40  80 所以需要用开始的时间排序 第二点:需注意题目的意思,贴图: 仔细观察图,注意1 3

AI蜗牛之家 1207

HDU 1050 Moving Tables

Moving Tables Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22480 Accepted Submission(s): 7587 Problem Description The famous ACM (Adv

小寒 385

贪心算法—杭电1050 Moving Tables

http://acm.hdu.edu.cn/showproblem.php?pid=1050

笨鸟 1462
上一篇: HDU - 2037 今年暑假不AC(贪心,最长连接)
下一篇: hdu 1203 I NEED A OFFER!(01背包,%%输出%符号)
Zero丶圈圈
博客等级 码龄9年 6粉丝 46原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值