首页 > 其他 > 详细

Codeforces Round #503 (by SIS, Div. 2)

时间:2019-11-23 10:04:19      阅读:87      评论:0      收藏:0      [点我收藏+]

A - New Building for SIS

题意:英语阅读,ab之间都有通道。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void test_case() {
    int n, h, a, b, q;
    scanf("%d%d%d%d%d", &n, &h, &a, &b, &q);
    while(q--) {
        int t1, h1, t2, h2;
        scanf("%d%d%d%d", &t1, &h1, &t2, &h2);
        if(t1 == t2)
            printf("%d\n", abs(h1 - h2));
        else if(a <= h1 && h1 <= b || a <= h2 && h2 <= b)
            printf("%d\n", abs(h1 - h2) + abs(t1 - t2));
        else
            printf("%d\n", min(abs(h1 - a) + abs(h2 - a), abs(h1 - b) + abs(h2 - b)) + abs(t1 - t2));
    }
}

int main() {
#ifdef KisekiPurin
    freopen("KisekiPurin.in", "r", stdin);
#endif // KisekiPurin
    int t = 1;
    for(int ti = 1; ti <= t; ++ti) {
        //printf("Case #%d: ", ti);
        test_case();
    }
}

Codeforces Round #503 (by SIS, Div. 2)

原文:https://www.cnblogs.com/KisekiPurin2019/p/11915091.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!