您的位置:首页 > 其它

#291 div.2

2015-02-15 16:59 323 查看

A.水题 数字翻转,将每一位大于等于5的数字t翻转成9-t,注意不要有前导0,且翻转后数字的位数不变(即9999->9000...刚开始以为应该翻转成0了= =)

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 1010;
int main()
{
int n, cnt1 = 0, cnt2 = 0;
double x0, y0, x, y;
double k[maxn];
scanf("%d%lf%lf", &n, &x0, &y0);
for(int i = 0; i < n; i++)
{
scanf("%lf%lf", &x, &y);
if(x-x0 == 0) {cnt1++; k[i] = 0; continue;}
if(y-y0 == 0) {cnt2++; k[i] = 0; continue;}
k[i] = (y-y0)/(x-x0);
}
sort(k, k+n);
int ans = unique(k, k+n) - k;
if(cnt1 && cnt2) ans++;
cout << ans << endl;
return 0;
}
View Code

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: