zoukankan      html  css  js  c++  java
  • HDU 1939 HE IS OFFSIDE

    He is offside!

    Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
    Total Submission(s): 538 Accepted Submission(s): 333


    Problem Description
    Hemisphere Network is the largest television network in Tumbolia, a small country located east of South America (or south of East America). The most popular sport in Tumbolia, unsurprisingly, is soccer; many games are broadcast every week in Tumbolia.

    Hemisphere Network receives many requests to replay dubious plays; usually, these happen when a player is deemed to be offside by the referee. An attacking player is offside if he is nearer to his opponents' goal line than the second last opponent. A player is not offside if
    ●he is level with the second last opponent or
    ●he is level with the last two opponents.

    Through the use of computer graphics technology, Hemisphere Network can take an image of the field and determine the distances of the players to the defending team's goal line, but they still need a program that, given these distances, decides whether a player is offside.
     
    Input
    The input file contains several test cases. The first line of each test case contains two integers A and D separated by a single space indicating, respectively, the number of attacking and defending players involved in the play (2 <= A,D <= 11). The next line contains A integers Bi separated by single spaces, indicating the distances of the attacking players to the goal line
    (1 <= Bi <= 104). The next line contains D integers Cj separated by single spaces, indicating the distances of the defending players to the goal line (1 <= Cj <= 104). The end of input is indicated by A = D = 0.
     
    Output
    For each test case in the input print a line containing a single character: "Y"(uppercase) if there is an attacking player offside, and "N"(uppercase) otherwise.
     
    Sample Input
    2 3 500 700 700 500 500 2 2 200 400 200 1000 3 4 530 510 490 480 470 50 310 0 0
     
    Sample Output
    N Y N
     
    Source
     
     
     
     
     
     
    #include<stdio.h>
    #include<string.h>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    int t1[10000],t2[10000];
    int main(){
         int a,b;
         while(scanf("%d%d",&a,&b)!=EOF){
                if(a==0&&b==0)
                break;
            memset(t1,0,sizeof(t1));
            memset(t2,0,sizeof(t2));
            for(int i=0;i<a;i++)
                scanf("%d",&t1[i]);
            for(int i=0;i<b;i++)
                scanf("%d",&t2[i]);
            sort(t1,t1+a);
            sort(t2,t2+b);
            if(t1[0]<t2[1])
                printf("Y
    ");
            else
                printf("N
    ");
            
         }
            
         return 0;
    }
  • 相关阅读:
    Java 写GBK 、utf8格式的文件 java
    NIOnio的美文分享一下,最近喜欢上了Nio希望能给大家扫扫盲
    maven入门和进阶 基础入门 希望帮助大家maven 教程
    log4j 基础
    FastDFS架构剖析(非常值得一看的架构分析和解读)
    FastDFS分布式文件系统问题总汇
    oracle 建表创建外键
    Mybatis下log4j日志输出不正常的解决办法 ,很实用哦 !!!!
    httpclient入门例子 demos
    Firebug http请求响应时间线
  • 原文地址:https://www.cnblogs.com/13224ACMer/p/4677454.html
Copyright © 2011-2022 走看看