Hard Way问题??? (为什么用double 不能过, 用 int可以??????)

Problem - A - Codeforces (Unofficial mirror by Menci)

#include <bits/stdc++.h>
using namespace std;
#define M 10000
#define ri register int 

struct dain{
    int  x,y;
    bool operator <(const dain &t)const
    {
        return y>t.y;
    }
}p[M];
int T;
int n,m;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    
    cin>>T;
    while(T--)
    {
        for(ri i=1;i<=3;i++) cin>>p[i].x>>p[i].y;
        sort(p+1,p+4);
        if(p[1].y==p[2].y) 
        {
            cout<<abs(p[1].x-p[2].x)<<"\n";
        }
        else cout<<"0\n";
    }
    return 0;
    
    
    
}
View Code

 

posted @ 2022-11-09 11:29  VxiaohuanV  阅读(13)  评论(0编辑  收藏  举报