栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

【Java每日一题,简单题】csp202203-3 风险人群筛查

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

【Java每日一题,简单题】csp202203-3 风险人群筛查

Introduction

Input

Output

输出共两行,每行一个整数,分别表示经过高危区域的人数和曾在高危区域逗留的人数。

Sample

input

5 2 6 20 40 100 80
100 80 100 80 100 80 100 80 100 80 100 80
60 50 60 46 60 42 60 38 60 34 60 30
10 60 14 62 18 66 22 74 26 86 30 100
90 31 94 35 98 39 102 43 106 47 110 51
0 20 4 20 8 20 12 20 16 20 20 20

output

3
2
Solution
import java.util.Scanner;

public class Main20200902 {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int k=s.nextInt();
        int t=s.nextInt();
        int Xl=s.nextInt();int Yb=s.nextInt();int Xr=s.nextInt();int Yu=s.nextInt();
        int count,max;
        int num1=0;int num2=0;
        for(int i=0;i
            count=0;
            max=0;
            for(int j=0;j
                int x=s.nextInt();int y=s.nextInt();
                if(x>=Xl&&x<=Xr&&y>=Yb&&y<=Yu){
                    count++;
                    max=Math.max(max,count);
                }else {
                    count=0;
                }
            }
            if(max!=0)num1++;
            if(max>=k)num2++;
        }
        System.out.println(num1);
        System.out.println(num2);

    }
}

Experience

前年考试的时候,卡了我3个小时,没过,今天我花了10分钟就写出来了,哎

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/924920.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号