首页 > 其他 > 详细

Codeforces Round #291 (Div. 2)(B)

时间:2015-02-16 01:41:13      阅读:228      评论:0      收藏:0      [点我收藏+]

水题但是WA2发了,要特别考虑斜率不存在的情况,最后的答案就是斜率不同的数目,set一下

#include<cstdio>
#include<cstring>
#include <iostream>
#include<queue>
#include <cmath>
#include <set>
using namespace std;
const int maxn=65000+10;
const int INF=1<<30;
typedef long long LL;

int main()
{
    #ifdef xxz
    freopen("in.txt","r",stdin);
    #endif // xxz
    int n;
    int x0,y0;
    while(cin>>n>>x0>>y0)
    {
        set<double> s;
       for(int i = 0; i < n; i++)
       {
           int x1,y1;
           double k;
           cin>>x1>>y1;
           if(x1 - x0 == 0) s.insert(999999999999.0333);
           else
           {
               k =(y1 - y0)*1.0/(x1 - x0);
               s.insert(k);
           }
       }

       cout<<s.size()<<endl;
    }
    return 0;
}


Codeforces Round #291 (Div. 2)(B)

原文:http://blog.csdn.net/u013445530/article/details/43844313

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