CCF 20140302 窗口

思路:以窗口为结构体,包含窗口id,所在层数layer,x1,x2,y1,y2。将所有窗口按层数从大到小排序,为了方便从最上层筛选点击的窗口;筛选到符合条件的窗口,break,在找到符合条件之前的所有窗口都减一。

#include <iostream>
#include <algorithm>

using namespace std;

const int N = 10;
struct win{
    int id;
    int layer;
    int x1,x2,y1,y2;
};
win w[N];

bool cmp(win w1,win w2){
    return w1.layer > w2.layer;
}
int main(){
    int n,m;
    cin>>n>>m;
    for(int i = 0; i < n; i++){
        cin>>w[i].x1>>w[i].y1>>w[i].x2>>w[i].y2;
        w[i].id = i + 1;
        w[i].layer = i + 1;
    }

    for(int i = 0; i < m; i++){
        int x,y;
        cin>>x>>y;
        int j;
        //按层数从大到小排序,先从顶层筛选符合条件的
        sort(w,w+n,cmp);
        for(j = 0; j < n; j++){
            if(w[j].x1 <= x && x <= w[j].x2 &&
               w[j].y1 <= y && y <= w[j].y2){
                cout<<w[j].id<<endl;
                w[j].layer = n;
                break;//找到后跳出,后面的不动
            }
            else{//在找到符合条件的窗口之前的窗口的层数都--
                w[j].layer--;
            }
        }
        if(j == n)
            cout<<"IGNORED"<<endl;
    }
    return 0;
}

### CCF CSP认证的时间安排报名流程 CCF CSP(软件能力认证)是由中国计算机学会主办的一项针对个人编程能力和算法设计水平的测试活动。以下是关于其时间安排和报名流程的具体说明: #### 时间安排 CCF CSP认证每年举行三次,分别在 **3月**、**9月** 和 **12月** 进行[^1]。每次考试包含五道题目,主要考察本科阶段学习到的基础数据结构和算法知识。 具体日期会由官方提前公布,在考前几个月可以通过 CCF 官方网站查询具体的考试时间和地点信息[^2]。 #### 报名流程 1. 登录 CCF 官网并注册账号。 2. 在指定时间内完成在线报名操作,并缴纳相应的费用。 3. 考试当天携带有效身份证件前往指定考点参加考试。 需要注意的是,考生需密切关注官网发布的最新动态以及各批次考试的确切时间节点。 ```python import datetime def check_exam_dates(): current_year = datetime.datetime.now().year exam_months = [3, 9, 12] upcoming_exams = [(current_year, month) for month in exam_months if month >= datetime.datetime.now().month] if not upcoming_exams: next_year = current_year + 1 upcoming_exams = [(next_year, month) for month in exam_months] return upcoming_exams upcoming_exams = check_exam_dates() print(f"Upcoming CCF CSP exams are scheduled for the following months of {', '.join([str(month) for _, month in upcoming_exams])}.") ``` 上述代码可以用来帮助用户查看即将到来的 CCF CSP 认证考试月份。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值