hdu_problem_2056_ Rectangles

ARM Cortex-M系列授权解析:从研发到量产的免费与付费之路 本文深入解析了ARM Cortex-M系列内核从研发到量产过程中的授权模式。研发阶段可利用ARM DesignStart等免费资源进行原型验证,但产品商业化量产则需支付授权费与版税。文章对比了采购商用MCU与自研芯片的成本差异,并探讨了RISC-V作为免费替代方案在IoT领域的应用前景与挑战,为开发者提供了清晰的选型指南。 阅读详情

题目大意:给两个矩形对角线上的点(主对角线或者副对角线),求两个矩形重叠部分的面积。
输入:每一行都是八个数字,对应4个点。
输出:输出重叠的面积,精确到小数点后两位。
方法:在这里插入图片描述

/*
*
*Problem Description
*Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are parallel to OX and OY .
*
*
*Input
*Input The first line of input is 8 positive numbers which indicate the coordinates of four points that must be on each diagonal.The 8 numbers are x1,y1,x2,y2,x3,y3,x4,y4.That means the two points on the first rectangle are(x1,y1),(x2,y2);the other two points on the second rectangle are (x3,y3),(x4,y4).
*
*
*Output
*Output For each case output the area of their intersected part in a single line.accurate up to 2 decimal places.
*
*
*Sample Input
*1.00 1.00 3.00 3.00 2.00 2.00 4.00 4.00
*5.00 5.00 13.00 13.00 4.00 4.00 12.50 12.50
*
*
*Sample Output
*1.00
*56.25
*
*
*Author
*seeyou
*
*
*Source
*校庆杯Warm Up
*
*
*Recommend
*linle
*
*/
#include<iostream>
using namespace std;
//            0  1  2  3  4  5  6  7 
double a[8];// x1,y1,x2,y2,x3,y3,x4,y4
double point[4];
int i;
int main() {
 while (~scanf_s("%lf%lf%lf%lf%lf%lf%lf%lf", &a[0],&a[1], &a[2], &a[3], &a[4], &a[5], &a[6], &a[7])){
  if (a[0] > a[2]) swap(a[0], a[2]);
  if (a[1] > a[3]) swap(a[1], a[3]);
  if (a[4] > a[6]) swap(a[4], a[6]);
  if (a[5] > a[7]) swap(a[5], a[7]);
  point[0] = a[0] > a[4] ? a[0] : a[4];
  point[1] = a[1] > a[5] ? a[1] : a[5];
  point[2] = a[2] < a[6] ? a[2] : a[6];
  point[3] = a[3] < a[7] ? a[3] : a[7];
  if (point[0] > point[2] || point[1] > point[3]) printf("0.00\n");
  else printf("%.2lf\n", (point[2] - point[0])*(point[3] - point[1]));
 }
 system("pause");
 return 0;
}
网络速度的极致:800G & 1.6T 以太网的突破! 你好,这里是网络技术联盟站。在我们进入数据驱动的世界时,以太网的重要性日益突出。从根本上说,以太网是一种连接计算机的技术,旨在形成一个本地网,通过它,设备可以与其他设备进行通信。然而,随着时间的推移,以太网已经发展成为一种全球的数据通信系统,其速度从初始的10Mbit/s发展到现在的800G,甚至1.6T。这种巨大的进步并不是没有挑战的,但每一次的突破都代表了技术的巨大飞跃。本文将探讨800G和1.6T以太网的创新与挑战。 阅读详情

相关推荐

基于STM32F407的定时器以及定时器中断的实现

基于STM32F407的定时器以及定时器中断的实现

weixin_57941207的博客 5232

HDUOJ 2056 Rectangles

HDUOJ 2056 Rectangles Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are parallel to OX and OY . Input Input

qq_45114168的博客 201

工业金属表面缺陷检测:4种光学成像方案(明/暗/漫/背光)选型与实测对比

本文深入探讨工业金属表面缺陷检测中的4种光学成像方案(明/暗/漫/背光),详细解析其物理原理、适用场景及实测效果。通过对比不同照明方案在铝合金轮毂、不锈钢餐具等实际工业场景中的表现,提供科学的选型决策树,帮助提升缺陷检出率至99%以上,为计算机视觉在工业质检领域的应用提供实用指南。

weixin_33624741的博客 389

hdu 2056

一开始我使用if else 语句来处理条件,好几次没显示过。后来受到其他coder的启发,运用函数体,这样显得代码简便清晰明了。 这一题不难,画个图就知道了。(以此为戒) #include #include #include using namespace std; double max(double x,double y){ if(x>y) return x;

努力努力再努力 253

告别虚拟机!在Windows上用WSL+VSCode搞定ArduPilot开发环境(保姆级避坑指南)

本文提供了一份详细的保姆级指南,介绍如何在Windows上使用WSL和VSCode搭建高效的ArduPilot开发环境,告别虚拟机性能损耗。从WSL安装、VSCode配置到ArduPilot固件编译和调试技巧,涵盖开发全流程中的关键步骤和常见问题解决方案,帮助无人机开发者快速构建专业级开发环境。

weixin_42543046的博客 462

13、离散时间系统建模与分析

本文系统介绍了离散时间系统的建模与分析方法,涵盖连续时间模型的离散化过程、系统稳定性判断准则、输入输出模型转换方法以及有限脉冲响应和阶跃响应模型的应用。通过多个示例详细展示了不同系统在离散化过程中的特性变化,并探讨了采样间隔对系统动态特性的影响。此外,文章还分析了时间延迟的处理方法,并总结了关键知识点及操作步骤,为离散时间系统的实际应用提供了理论基础和实践指导。

2w3e4r5t6y的博客 191

21.Rectangles

输入第一行输入是8个正数,表示每个对角线上必须有四个点的坐标。这8个数字是x1、y1、x2、y2、x3、y3、x4、y4。这意味着第一个矩形上的两个点是(x1,y1)、(x2,y2);第二矩形上的另外两个点是(x3,y3),(x4,y4)。||判断原则:从左往右判断,碰到真直接返回true后面不管,是假一直判断到后面,直到全部语句 判断完。给定两个矩形和每个矩形对角线上两个点的坐标,你必须计算两个矩形相交部分的面积。不想交情况的判断:注意||判断的条件顺序。

m0_73673820的博客 460

基于Verilog的8位CPU设计及UART扩展实现方案,包含完整的架构设计、核心代码实现和仿真验证方法

基于Verilog的8位CPU设计及UART扩展实现方案,包含完整的架构设计、核心代码实现和仿真验证方法

a_zxswer的博客 193

杭电OJ2056(求俩矩形相交的面积)

Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are pa...

逐梦er的博客 2383

Unity WebView 插件⭐️(十八)3D WebView 原生2D模式 — Native 2D Mode

Unity中的 浏览器插件:3D WebView,利用好该插件我们可以自己使用Unity打造出一个自定义的多样化浏览器。可以用于2D显示,也可以用于3D空间场景中使用,在PC端、手机端和VR设备等都可以有一个非常好的效果。一起来浏览器插件:3D WebView的专栏学习使用吧!

努力前行,总会成为自己心中的那道光 7643

深度学习部署工程师--8(docker+TensorRT部署到推理+yolo人体检测)下

本文介绍了YOLOv5模型通过TensorRT加速部署的流程。首先需要检查磁盘空间,确保有30GB可用。文章对比了不同推理方式的性能:int8量化+TensorRT可达200FPS,纯TensorRT为166FPS,CUDA为147FPS,CPU为93FPS。重点讲解了将YOLOv5模型导出为ONNX格式的详细步骤,包括修改Detect类的forward方法以移除decode运算,使用git patch批量修改代码,安装必要的依赖库,以及通过onnx-graphsurgeon工具修改ONNX图结构。最终目标

FJN110的博客 496

2056——Rectangles

Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are

X² 733

yolov26改进 | 融合改进篇 | 基于 MobileNetV4 和双向特征金字塔网络BiFPN的融合改进(全网独家首发)

本文介绍BiFPN与MobileNetV4融合改进的YOLOv26。许多模块单独使用能够涨点,但直接叠加后可能因功能重复、通道不匹配、尺度冲突而掉点,因此融合前必须理解各模块作用。MobileNetV4利用UIB与Mobile MQA构建轻量主干,提升特征提取能力;BiFPN通过可学习权重完成双向多尺度融合,强化大、中、小目标的信息交互。两者优化Backbone与Neck,功能互补、结构冲突较少。本文提供代码、配置、消融对比及Codex修改思路,MobileNetV4也可替换其他主干,便于组合实验与二次创新

Snu77的博客 244

HDU 2056 Rectangles

http://acm.hdu.edu.cn/showproblem.php?pid=2056 Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the ...

weixin_30747253的博客 173

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

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

HDU 2056 - Rectangles

Rectangles Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 29464    Accepted Submission(s): 9573   Problem Description Given two rectangles ...

仙女的博客 239

计算机控制技术及应用

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

杭电OJ第11页2055~2059算法题(C语言)

目录2055.An easy problem2056.Rectangles2057.A + B Again2058.The sum problem2059.龟兔赛跑 2055.An easy problem Problem Description we define f(A) = 1, f(a) = -1, f(B) = 2, f(b) = -2, ... f(Z) = 26, f(z) = -26; Give you a letter x and a number y , you should outpu

代码星辰的博客 2070

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

矩形相交的面积

杭电2056 Rectangles Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectan

zw1996的博客 3005

HUD2056 Rectangles

Rectangles Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 24963    Accepted Submission(s): 8116 Problem Description Given two rect

小战 千里不回头 354

HDU 2056 Rectangles (求相交矩形的面积)

Rectangles Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11631 Accepted Submission(s): 3716 Problem Description Given two rectangles

公众号:ByteCode 3721

杭电ACM2056java做法

Rectangles Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. i

SuperBeauty的专栏 1144

two points

1、首先转载一部分two points 的基础吧 https://www.cnblogs.com/hxtblogs/p/7654536.html 这个简单的例子中 两个指针一个从前,一个从后,进行扫描。从而提高了程序的效率。 暴力求解: for(int i = 0;i &amp;lt; n; i ++){ for(int j = i+1; j &amp;lt; n; j++){ ...

zhengqiang的博客 1221

HDOJ-2056(Rectangles)

Rectangles Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19475    Accepted Submission(s): 6316 Problem Description Given two rectangl

hpulw 1958

【杭电100题】校庆杯Warm Up 2056 Rectangles_矩形相交面积

Problem Description Given two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are p...

夏至是个程序媛 325

HDU2056 Rectangles【水题】【相交面积】

题目大意:给你两个矩形对角线两端的坐标,输出这两个矩形的相交面积 思路:假设两个矩形相交,则相交的矩形面积横坐标为四个横坐标中间的 两个横坐标,纵坐标为四个纵坐标中间的两个纵坐标,然后计算面积。若 两个矩形不相交,则相交面积为0.00。 那么怎么判断是否相交呢。思路很简单,分别计算出矩形1和矩形2最小和 最大和横、纵坐标,若矩形1的最小横坐标>=矩形2的最大横坐标 或者 矩形1的最大横坐标<=矩形2的最小横坐标 则两个矩形不可能相交,同理, 纵坐标也是如此。

程序员充电站(itcharge) 1422

深挖C++:类和对象(中)

(先进后出)

xys_678的博客 257
上一篇: hdu_problem_2055_An easy problem
下一篇: hdu_problem_2057_A + B Again
CoderZhuuu
博客等级 码龄10年 26粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值