• test


    #pragma comment(linker, "/STACK:102400000,102400000")
    #include <math.h>
    #include <time.h>
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <set>
    #include <map>
    #include <string>
    #include <stack>
    #include <queue>
    #include <vector>
    #include <bitset>
    #include <iostream>
    #include <algorithm>
    #define pb push_back
    #define fi first
    #define se second
    #define icc(x) (1<<(x))
    #define lcc(x) (1ll<<(x))
    #define lowbit(x) (x&-x)
    #define debug(x) cout<<#x<<"="<<x<<endl
    #define rep(i,s,t) for(int i=s;i<t;++i)
    #define per(i,s,t) for(int i=t-1;i>=s;--i)
    #define mset(g, x) memset(g, x, sizeof(g))
    using namespace std;
    
    typedef long long ll;
    typedef unsigned long long ull;
    typedef unsigned int ui;
    typedef double db;
    typedef pair<int,int> pii;
    typedef pair<ll,ll> pll;
    typedef vector<int> veci;
    const int mod=(int)1e9+7,inf=0x3fffffff,rx[]={-1,0,1,0},ry[]={0,1,0,-1};
    const ll INF=1ll<<60;
    const db pi=acos(-1),eps=1e-8;
    
    template<class T> void rd(T &res){
        res = 0; int ch,sign=0;
        while( (ch=getchar())!='-' && !(ch>='0'&&ch<='9'));
        if(ch == '-') sign = 1; else res = ch-'0';
        while((ch=getchar())>='0'&&ch<='9') res = (res<<3)+(res<<1)+ch-'0';
        res = sign?-res:res;
    }
    template<class T>void rec_pt(T x){
        if(!x)return;
        rec_pt(x/10);
        putchar(x%10^48);
    }
    template<class T>void pt(T x){
        if(x<0) putchar('-'),x=-x;
        if(!x)putchar('0');
        else rec_pt(x);
    }
    template<class T>inline void ptn(T x){ pt(x),putchar('
    '); }
    template<class T>inline void Max(T &a,T b){ if(b>a)a=b; }
    template<class T>inline void Min(T &a,T b){ if(b<a)a=b; }
    template<class T>inline T mgcd(T b,T d){ return b?mgcd(d%b,b):d; }//gcd模板,传入的参数必须是用一类型
    //-------------------------------主代码--------------------------------------//
    
    map<pair<ll, int>, int> mmp;
    
    int main()
    {
        int n;
        cin >> n;
        while (n --) {
            int x,y;
            cin >> x >> y;
            // ->
            pair<ll, int> tmp;
            tmp.first = x;
            tmp.second = 0;
            mmp[tmp]++;
            // 1
            if (y > x) {
                tmp.first = -(y - x);
            } else {
                tmp.first = x - y;
            }
            tmp.second = 1;
            mmp[tmp]++;
            //2
            tmp.first = y;
            tmp.second = 2;
            mmp[tmp]++;
            //3
            tmp.first = x + y;
            tmp.second = 3;
            mmp[tmp]++;
        }
        
        ll ans = 0;
        map<pair<ll, int>, int>::iterator p;
        for (p = mmp.begin(); p != mmp.end(); p++) {
            ll _value = (*p).second;
            pair<ll, int>_tmp = (*p).first;
            ans += _value * (_value - 1) /2;
        }
        cout << ans;
        return 0;
    }
    
    
    #ifdef CJS_DEBUG
    /**************/
    
    5
    1 1
    2 2
    3 3
    1 3
    3 1
    
    /***********/
    #endif
  • 相关阅读:
    Odoo安装教程2-创建新的插件模块第一讲
    Odoo安装教程1-创建第一个 Odoo 应用
    Odoo开发教程21-Odoo服务器端开发者模式
    Ubuntu 安装LAMP
    Roundcube Webmail信息泄露漏洞(CVE-2015-5383)
    Roundcube Webmail跨站脚本漏洞(CVE-2015-5381 )
    Roundcube Webmail File Disclosure Vulnerability(CVE-2017-16651)
    Roundcube 1.2.2
    XAMPP重置MySQL密码
    python importlib动态导入模块
  • 原文地址:https://www.cnblogs.com/chenhuan001/p/6682834.html
Copyright © 2020-2023  润新知