赞
踩
//32位整数-2147483628~2147483647 //绝对值后就超过int范围 #include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <map> using namespace std; typedef long long LL; typedef pair<LL, LL> PII; map<PII, vector<PII> >mp; int n; LL sum,cnt; int gcd(LL a, LL b) { return b?gcd(b,a%b):a; } int main() { scanf("%d", &n); while (n -- ) { LL a,b; int c; scanf("%lld%lld%d",&a,&b,&c); sum+=c; int d = gcd(abs(a),abs(b)); mp[{b/d, a/d}].push_back({a*a+b*b,c}); } for(auto i=mp.begin();i!=mp.end();i++) { vector<PII> v = i->second; sort(v.begin(),v.end()); for(int j=0;j<v.size();j++) { if(v[j].second!=1) cnt++; else { if(v[j].second!=v[j+1].second&&j<v.size()) cnt++; } } } printf("%lld %lld\n",sum,cnt); return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。