POJ2826

Excel转图表替代方案:Visio原生/VBA/Mermaid三路径实战 Excel数据可视化是办公自动化中的基础能力,核心在于将结构化表格数据转化为可交互、可维护的图形表达。其原理依赖数据绑定、字段映射与图形语义解析,技术价值体现在降低人工绘图成本、支持动态更新与跨平台复用。典型应用场景包括组织架构图、流程图、课程拓扑图及设备拓扑管理。随着Excel Data Visualizer退役,用户亟需稳定、可控且兼容现代工作流的替代方案——Visio原生数据连接、VBA自动化脚本、Mermaid代码生成成为三大主流路径,分别适配零代码行政人员、企业IT支持团队及Mac/远程协作场景。 阅读详情

传送门:An Easy Problem?!


题意:就两个线段相交,当做雨水收集器,求问可以收集多少雨水。


分析:题意简单,思路也简单。但数据很坑。。。
情况1:有一条线段平行x轴输出0
情况2:两条线段平行或重合或无交点,输出0
情况3:一条线段覆盖了另一条线段的上半部分,就是雨水无法流入两条线段之间,这个比较难想


程序不难写,但精度卡死人。。。
最后提交时候答案加了个eps就神奇的过了。。。

WA了13次。。。 

代码如下:

#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

const double eps = 1e-8;
int dcmp(double x){
   if (fabs(x)<eps) return 0;
   return x<0?-1:1;
}

struct Point{
   double x,y;
   Point(double x=0,double y=0):x(x),y(y){}
   bool operator ==(const Point& rhs) const {
      return dcmp(x-rhs.x)==0 && dcmp(y-rhs.y)==0;
   }
};

typedef Point Vector;

Vector operator +(Vector A, Vector B) {return Vector(A.x+B.x,A.y+B.y); }
Vector operator -(Vector A, Vector B) {return Vector(A.x-B.x,A.y-B.y); }
Vector operator *(Vector A, double p) {return Vector(A.x*p,A.y*p); }

double Cross(Vector A,Vector B) { return A.x*B.y-A.y*B.x; }
double Dot(Vector A,Vector B) { return A.x*B.x+A.y*B.y; }

struct Line{
    Point p1,p2;
    Line(){}
    Line(Point p1,Point p2):p1(p1),p2(p2){}

    double getK(){
       return (p1.y-p2.y)/(p1.x-p2.x);
    }
};

bool isParallel(Line a, Line b){
   return dcmp(Cross(a.p1-a.p2,b.p1-b.p2))==0;
}

bool SegmentProperIntersection(Line a, Line b){
    double c1 = Cross(a.p2-a.p1,b.p1-a.p1), c2 = Cross(a.p2-a.p1,b.p2-a.p1);
    double c3 = Cross(b.p2-b.p1,a.p1-b.p1), c4 = Cross(b.p2-b.p1,a.p2-b.p1);
    return dcmp(c1)*dcmp(c2)<0 && dcmp(c3)*dcmp(c4)<0;
}

Point GetLineIntersection(Point P, Vector v, Point Q, Vector w){
    Vector u = P-Q;
    double t = Cross(w,u)/Cross(v,w);
    return P+v*t;
}

bool OnSegment(Point p, Point a1, Point a2){
   return dcmp(Cross(a1-p,a2-p))==0 && dcmp(Dot(a1-p,a2-p))<0;
}

bool isIntersect(Line a, Line b, Point& p){
    if (SegmentProperIntersection(a,b)) {
        p = GetLineIntersection(a.p1,a.p1-a.p2,b.p1,b.p1-b.p2);
        return 1;
    }

    if (OnSegment(a.p1,b.p1,b.p2)) { p = a.p1; return 1; }

    if (OnSegment(b.p1,a.p1,a.p2)){ p = b.p1; return 1; }

    if (a.p1==b.p1) { p = a.p1; return 1; }

    return 0;
}

int main(){
    int T;
    scanf("%d",&T);

    double x1,y1,x2,y2;
    Line L1,L2;

    while (T--){
        scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
        if (y1>y2) {
            swap(y1,y2);
            swap(x1,x2);
        }
        L1 = Line(Point(x1,y1),Point(x2,y2));

        scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
        if (y1>y2) {
            swap(y1,y2);
            swap(x1,x2);
        }
        L2 = Line(Point(x1,y1),Point(x2,y2));

        if (dcmp(L1.p1.y-L1.p2.y)==0 || dcmp(L2.p1.y-L2.p2.y)==0) { printf("0.00\n"); continue; }

        if (isParallel(L1,L2)) { printf("0.00\n"); continue; }

        Point p;
        if (!isIntersect(L1,L2,p)) {
                printf("0.00\n");
                continue;
        }
        else {
           L1.p1 = p; L2.p1 = p;
           if (dcmp(L1.p1.x-L1.p2.x)!=0 && dcmp(L2.p1.x-L2.p2.x)!=0 ){
              double k1 = L1.getK(), k2 = L2.getK();
              if (dcmp(k1*k2)>0) {
                if ( dcmp(k1-k2)>0 && dcmp(L1.p2.x-L2.p2.x)>=0 || dcmp(k1-k2)<0 && dcmp(L1.p2.x-L2.p2.x)<=0 ) {
                  printf("0.00\n");
                  continue;
                }
              }
           }

           Line L3;
           if (L1.p2.y<L2.p2.y) {
               L3 = Line(L1.p2,Point(L1.p2.x+1,L1.p2.y));
               L2.p2 = GetLineIntersection(L2.p1,L2.p1-L2.p2,L3.p1,L3.p2-L3.p1);
           }
           else {
               L3 = Line(L2.p2,Point(L2.p2.x+1,L2.p2.y));
               L1.p2 = GetLineIntersection(L1.p1,L1.p1-L1.p2,L3.p1,L3.p2-L3.p1);
           }
           printf("%.2f\n",fabs(Cross(L2.p2-p,L1.p2-p))/2+eps);

        }

    }
    return 0;
}

SAP PS项目结算实操:从CJ20N到CJ88,手把手搞定项目成本结转与凭证生成 本文详细解析SAP PS项目结算全流程,从CJ20N到CJ88的操作要点,涵盖成本归集、结算规则配置、结果分析及凭证生成等关键环节。特别针对FICO模块中的项目凭证流转问题提供实战解决方案,帮助财务人员规避常见配置错误,提升项目结算效率与准确性。 阅读详情

相关推荐

Jetson-nano 编译实时内核并烧录

前言 之前一篇文章介绍了正常的烧录过程,使用的是默认内核,实际工作中需要对内核打补丁升级为实时内核,并对其重编译。 一、准备内容 官网大法好 官方内核下载链接 官方交叉编译器下载链接 官方文档 ubuntu主机一台 根据官网选择下载对应的文件, 1、L4TDriver Package (BSP) source jetson内核文件。 2、官方交叉编译器 因为我们不是在jetson上直接编译,而jetson是arm平台,所以要进行交叉编译。 二、使用步骤 1.解压 内核 tar -xjf public_s

ldl371122的博客 3287

POJ 2826 两线段关系求面积

题意:两个木板接雨,问你能解多少雨,也就是面积。 这题考虑几种情况:1,有线段平行x轴,接不到;2,两线段没交点,接不到;3,取两线段高的端点如果比两线段交点低也接不到;4,最不容易想到的,两木板在同侧并且上面的木板盖住了下面的木板也接不到。这四条单独判断然后求三角形面积就可以了。 #include #include #include #include #include using name

韩小侠的专栏 已迁移至lssea.com 8384

Adversarial Texture for Fooling Person Detectors in the Physical World

本文提出了对抗纹理的想法(AdvTexture),与基本补丁攻击不同对抗纹理可以生成任意大小,可以覆盖任意大小的不了,并且纹理的任何局部都有对抗性的效果。当衣服被对抗纹理覆盖是,摄像头捕捉到的每一个局部区域都可以攻击探测器,这成功解决了片段缺失的问题。提出了一种两阶段生成方法:基于环形收割的可扩展生成攻击(TC-EGA)来制作广告纹理。第一阶段,训练一个全卷积网络FCN作为生成器,通过采样随机潜变量作为输入来产生纹理(不同于GAN中传统的生成器架构,每一层都使用卷积运算)......

weixin_49171105的博客 1067

poj 2826 一道神奇的水题,死活都过不了,等以后再看吧

#include #include #include #include #include #include #include #include using namespace std; #define rd(x) scanf("%d",&x) #define rdd(x,y) scanf("%d%d",&x,&y) #define rddd(x,y,z) scanf("%d%d%d",&x,&y,

zjck1995的专栏 474

SCS 43. 利用Scissor算法从单细胞数据中挖掘临床表型关联的细胞亚群

本文详细介绍了Scissor算法在单细胞转录组数据分析中的应用,该算法能够精准挖掘与临床表型关联的细胞亚群。通过建立单细胞RNA测序数据与临床预测模型的直接关联,Scissor避免了传统聚类方法的局限性,为疾病机制研究和个性化医疗提供了新工具。文章还涵盖了数据预处理、模型选择、结果验证等实战技巧。

weixin_28736335的博客 492

手把手教你学simulink(90.1)--直流电动机实例:基于Simulink的基本模型的直流电动机(DC Motor)建模

直流电动机(DC Motor)因其结构简单、控制方便和良好的调速性能,广泛应用于各种工业自动化、机器人技术、家用电器以及航空航天等领域。为了更好地理解和应用直流电动机的工作原理及其控制系统,本项目旨在通过Simulink对直流电动机进行基本模型的建模与仿真。

MHD0815的博客 439

POJ2826计算几何、线段交点

题目 An Easy Problem?! 在平面中给出两条线段,问最多能接到多少从上至下的雨水。 解题思路 要能接到雨水,首先得满足两条线段相交形成‘V’型结构,相交大致有以下情况,比较难考虑到的有情况3、4: 来找四种情况的特征即可。方法很多,下面是一种可行方法 情况2:点1点2的y坐标相同 情况1:过点1作垂线与直线23交于点5,点5的y坐标小于直线14-23的交点坐标。 情况3、4:作点1的垂线交直线23于点5,判断点5点3上方还是下方即可。 判断方法很多,尽量减少运算次数、除法为优。 代码 #in

陈颜的博客 308

基于ESP32的室内空气质量检测系统开发

随着环境污染问题的日益严重,室内空气质量的监测变得越来越重要。室内空气质量的好坏直接影响到人们的健康,尤其是对于在封闭空间长时间待着的人群。为此,基于ESP32的室内空气质量检测系统应运而生。ESP32作为一款集成了Wi-Fi和蓝牙的高性能微控制器,为嵌入式开发提供了良好的平台,适用于构建各种智能硬件设备。本博客将详细介绍如何基于ESP32开发一个室内空气质量检测系统。系统可以实时监测空气中的温度、湿度、二氧化碳浓度、甲醛浓度等指标,并通过Wi-Fi将数据传输到云端或移动设备,方便用户随时查看空气质量情况。

2201_76125393的博客 831

poj2826(垃圾精度题)

求两块木板能装雨水的面积,垃圾题WA了几十发,随机数造了几十万组数据过了还是WA,最后用上long double加特判过的,特判了一块木板水平的情况,我也不知道为什么要特判,按我的做法这种情况不特判也会输出0的,数据是真的坑。 #include &lt;cstdio&gt; #include &lt;cstring&gt; #include &lt;cmath&gt; #include &...

bpdwn2017的博客 457

反应堆设计:基于MATLAB的反应堆仿真和分析,包括反应堆稳态分析、反应堆动态分析和反应堆安全分析 介绍

反应堆设计是利用计算机技术对核反应堆进行设计和模拟,以获得安全、高效、经济的核能发电系统。它是核能领域的重要组成部分,在电力生产、核医学、科学研究等领域有着广泛的应用。

走向CTO的路上... 1112

构建基于知识图谱的金融监管合规系统

金融行业是一个高度监管的领域,金融机构需要遵守众多复杂的法规和政策。传统的金融监管合规方式往往依赖于人工审查和简单的规则引擎,效率低下且容易出错。构建基于知识图谱的金融监管合规系统的目的在于利用知识图谱强大的知识表示和推理能力,实现对金融业务数据的自动化分析和合规检查,提高监管合规的效率和准确性。本系统的范围涵盖了金融机构的各类业务,如银行业务、证券业务、保险业务等。

AI天才研究院 1166

poj 2826

题目概述在二维平面中,将两块直木板的某个位置钉起来装雨水,雨水从y轴正方向向下落下,给出木板四个端点的坐标,且木板可视为线段,问钉成的木板装满水时雨水的横截面积时限1000ms/3000ms输入第一行正整数N,代表数据组数,第二行四个整数,描述第一块木板端点坐标,第三行四个整数,描述第二块木板端点坐标,两组中间会有一个空行限制坐标绝对值<=10000输出每行一个数,所求横截面积,保留2位小数样例输入

[CHN]liurui 570

CAPL诊断功能实现

UDS(Unified Diagnostic Services)是一种用于汽车电子系统诊断的标准协议。它定义了一系列诊断服务,用于读取和写入车辆电子控制单元(ECU)中的数据,以及处理诊断故障码(DTC)。UDS协议通常运行在CAN总线上,使用ISO 15765-2(ISO-TP)协议进行数据传输。通过本文的学习,读者应该对CAPL诊断功能实现有了初步的了解,并能够编写复杂的CAPL脚本。在实际项目中,CAPL的应用非常广泛,希望读者能够通过不断的学习和实践,掌握更多的CAPL技巧,提高自己的开发能力。

闲人编程的博客 1516

POJ2826:计算几何

POJ2826 题解:看似简单的题,却很考验综合能力 容量为0的情况 其中一条线段与x轴平行 两天线段平行或者重合 两条线段无交点 有交点,但一条线段的上半部分却覆盖掉了另外一条线段的上半部分。这里需要求斜率。 C++AC,G++WA的代码 代码 #include <iostream> #include <cstdio> #include <algo...

FlyingJack 237

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

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

POJ 2826 An Easy Problem?!

POJ 2826 An Easy Problem?! Description It’s raining outside. Farmer Johnson’s bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his barn. Shown in the pictures ...

旺崽的博客 3083

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

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

poj 2826 An Easy Problem?! 线段公共点终极问题

题目地址:poj2826 1 最神奇的地方--wa了以后,ans+eps  就过了  2  逻辑关系图    首先分为     if(没有公共点||平行|| 有水平的)   {     输出0;  }  else  {     if(雨根本进不来) 输出0;    else {      把有一个公共端点和规范相交联合考虑‘     关键是提取出“上面的”端点,  

Jingqi@Mr.B的ACM博客 989

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

POJ2826 An Easy Problem?!

  原题链接:http://poj.org/problem?id=2826   这道题要的思路很容易,但把代码写丑也很容易。   接到的水的截面体积为0的情况有:   1. 两条线段不相交;   2. 其中任意一条线段水平;   3. 两条线段重合;   4. 相交的情况下,最高的端点遮住了次高的端点      这道题断断续续搞了一周才搞定,POJ上wa了几个版面。几何题,同样的功...

weixin_30412577的博客 106

POJ 2826 An Easy Problem?!(计算几何)

题目链接:http://poj.org/problem?id=2826 题意:有两条长度相等的线段(两块木板),端点坐标均已给出,问若下雨,则两块木板拼成的容器可以容纳多少雨水(用面积表示) 思路:写了之后才明白题目标题里的?!.....简直是本人一个下午的状态了....说好的easy呢..WA到真的自闭....... 1.先考虑两个线段是否有交点,若无交点或者共线,则输...

AmarisCR的博客 254

【POJ2826】An Easy Problem?!(线段相交+分情况讨论+精度)

题目地址:http://poj.org/problem?id=2826 题目: 给出两条线段(木板的侧切面,木板宽度默认为1),求能接住雨水的水量,保留两位小数 解题思路: 这道题有很多种情况需要考虑。 (1)首先判断两条线段是否相交且只有一个交点。 (2)若满足条件(1),取交点上面的点(这些点才有用),最好的情况是线段L1的a点在交点上方,线段L2的b点在交点上方,那么剩...

Cassie_zkq的博客 331

POJ - 2826 An Easy Problem?!

计算几何好题,神学过题 POJ - 2826 An Easy Problem?! 题意:t组数据。每组数据给你两根棍子,天上会下雨,问两根棍子组成的图形最多可以装多少水 思路:其实要求两根棍子组成的图形,开口向上的可装水三角形的面积 步骤1: ①:特判掉存在有棍子与x轴平行的情况 ②:特判掉两根棍子没有交点的情况 ③:特判掉两根棍子平行的情况 步骤2:求出两根棍子的交点inter,并找出两根棍子中y值大于交点y值的所有端点cnt,存在dot数组里面 只有y值大于交点y值的才可能做出贡献(0<=cnt&

一只大菜鸡的博客 367

poj 2826 An Easy Problem?! (变态卡数据题)

题目链接:poj 2826 题意:给出两条直线,水从天上落下,问:这两条直线组成的平面容器能装多少水? 题解:很gou的题,超级变态卡数据,艹,足足搞了我几天,总算搞出来了。 参考链接:https://www.cnblogs.com/kuangbin/p/3192511.html kuangbin神犇的,不过它代码少了一句话,已经加上去了   这种情况是覆盖的,   注意答案要加...

Jiandong 416

POJ 2826 An Easy Problem? 判断线段相交

POJ 2826 An Easy Problem?!--思路来自kuangbin博客 下面三种情况比较特殊,特别是第三种 G++怎么交都是WA,同样的代码C++A了 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #i...

weixin_34336292的博客 119

POJ 2826 An Easy Problem!?(超级恶心!!!···)

题目:POJ2826 这道题WA了无数次啊。。。惨不忍睹,到现在实在找不到错了。。T_T 题目大意:两块木板,随意摆放,有雨水垂直落下到两块木板所形成的空间中,求能盛多少雨水(面积)。如图: 那么能盛放的雨水便是蓝色部分的面积。看起来很简单···实际上要考虑的情况很多啊!能1A的人都是神呐! 大概有以下几种要特别注意的情况: 1.有其中一个木板与地面平行,输出0 2.两个木...

weixin_30621711的博客 123
上一篇: ZOJ 1610 Count the Colors 线段树区间修改
下一篇: HDU2892 求多边形与圆相交面积
罗侯
博客等级 码龄10年 135粉丝 258原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值