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

水题但是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 xxzfreopen("in.txt","r",stdin);#endif // xxzint 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)

相关文章:

你感兴趣的文章:

标签云: