csu1840Lawn mower(水)

本文介绍了一个有趣的草坪修剪问题,要求确保足球场每一寸草地都被修剪至少两次:一次沿长度方向,一次沿宽度方向。通过编程解决方案来帮助混乱的操作员Guido完成任务。

Description

    The International Collegiate Soccer1 Competition (ICSC) is famous for its well-kept rectangular stadiums. The grass playing fields in ICSC stadiums are always 100 meters long, and 75 meters wide. The grass is mowed every week with special lawn mowers, always using the same strategy: first, they make a series of passes along the length of the field, and then they do the same along the width of the field. All passes are straight lines, parallel to the sides of the field.

    The ICSC has hired a new lawn-mower, Guido. Guido is very chaotic, and instead of covering the field incrementally, he likes to choose random starting positions for each of his passes. But he is afraid of not doing a good job and being red by the ICSC, so he has asked you to help him. Write a program to make sure that the grass in the field is perfectly cut: all parts of the field have to be mowed at least once when the mower goes from end to end, and again when the mower goes from side to side.

Input

  Each test case contains 3 lines. The fi rst line contains two integers, nx (0 < nx < 1 000) and ny (0 < nx < 1 000), and a real number w (0<w500<w≤50), which represents the width of the cut of that particular lawn mower. The next line describes the end-to-end passes (along the length of the field), and contains nx real numbers xi (0xi750≤xi≤75) describing the starting positions of the mower's center in Guido's end-to-end passes. The last line describes the side-to-side passes, with ny real numbers yi (0yi1000≤yi≤100).

  The end of the test cases is signalled with a line that contains the numbers 0 0 0.0. You should generate no output for this line, as it is not a test case.

  Real numbers for w, xi and yi can have up to 7 digits after the decimal point, and any cut will also include its boundaries. For example, if a 2.0-meter wide cut is performed along the 10.0-meter mark, then a strip of grass from 9.0 to 11.0 (including both) will be considered "cut".

Output

  Print YES if Guido has done a good job, or NO if some part of the field has not been mowed at least once when the mower was travelling along the length of the field, and again when it was travelling along the width.

Sample Input

8 11 10.0
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0
8 10 10.0
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0
0.0 10.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0
4 5 20.0
70.0 10.0 30.0 50.0
30.0 10.0 90.0 50.0 70.0
4 5 20.0
60.0 10.0 30.0 50.0
30.0 10.0 90.0 50.0 70.0
0 0 0.0

Sample Output

YES
NO
YES
NO

水题呀,赶快切了,排序一下再维护标记
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string.h>
using namespace std;
double xi[1005],yi[1005];
int main()
{
    int nx,ny;
    double w;
    while(cin>>nx>>ny>>w)
    {
        bool suc=true;
        if(nx==0&&ny==0&&abs(w)<1e-5)
            break;
        for(int i=0;i<nx;i++)
            cin>>xi[i];
        for(int i=0;i<ny;i++)
            cin>>yi[i];
        sort(xi,xi+nx);
        sort(yi,yi+ny);
        double endx=xi[0]+w/2.0;
        double endy=yi[0]+w/2.0;
        for(int i=1;i<nx;i++)
            if(endx<xi[i]-w/2.0)
            {
                suc=false;
                break;
            }
            else
                endx=xi[i]+w/2.0;
        if(endx<75&&suc)
            suc=false;
        if(suc)
        {
            for(int i=1;i<ny;i++)
            if(endy<yi[i]-w/2.0)
            {
                suc=false;
                break;
            }
            else
                endy=yi[i]+w/2.0;
            if(endy<100)
                suc=false;
        }
        if(suc)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}




【从高压输电线的架空地线中汲取电能】一个25千瓦受控电源从735千伏线路的架空地线中汲取电能的SimPowerSystems模型(Simulink仿真实现)内容概要:本文介绍了一个基于SimPowerSystems的Simulink仿真模型,用于模拟从735千伏高压输电线的架空地线中汲取25千瓦电能的受控电源系统。该模型聚焦于高压输电线路中架空地线的能量回收技术,通过仿真手段实现对电能采集过程的建模与控制策略验证,体现了电力系统中新型能源获取方式的技术可行性与工程应用潜力。文中还提及该资源属于一系列电力系统仿真研究的一部分,涵盖微电网、储能优化、碳流追踪、鲁棒调度等多个前沿方向,配套提供Matlab/Simulink代码及网盘资料链接,便于科研人员复现与拓展研究。; 适合人群:具备电力系统基础知识、熟悉Matlab/Simulink仿真环境,从事电力工程、能源回收或智能电网相关研究的科研人员及研究生;有一定编程与建模仿真经验的高年级本科生或工程技术人员。; 使用场景及目标:①研究高压输电线路中架空地线的能量回收机制与建模方法;②掌握基于Simulink的电力系统仿真技术,特别是受控电源与电网交互的动态特性分析;③为开展能源 harvesting、分布式供能、电力电子变换器控制等相关课题提供参考模型与技术支撑; 阅读建议:建议结合提供的仿真模型文件进行实操演练,重点理解系统结构设计、参数设置与控制逻辑实现;同时可延伸学习文档中提到的其他电力系统优化与仿真案例,以拓宽研究视野和技术积累。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值