#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
相关文章推荐
- codeforces Round #117 Div.2 182E. Wooden Fence
- codeforces Round #184 Div.2 - B Continued Fractions
- Codeforces Round#194(Div.2) A Candy Bag
- CodeForces#203(Div.2)- A,B,C
- codeforces round#235 (div.2) A,B,C
- codeforces round #236 div.2 C
- CF#256(Div.2) A. Rewards
- Round #186 (Div.2) Ilya and Matrix
- Codeforces Round #266 (Div.2) B Wonder Room --枚举
- TopCoder SRM 639 Div.2 500 AliceGameEasy --乱搞
- Szucoder Round #4 (div.2)
- CodeForces Round #288 Div.2
- CodeForces #292 div.2 题解
- CodeForces Round #295 Div.2
- #290 (div.2) B. Fox And Two Dots
- CodeForces Round #297 Div.2 E (中途相遇法)
- #308 (div.2) C. Vanya and Scales
- codeforces Round 314 div.2
- BestCoder Round #50 (div.2) HDU 5365 Run(简单几何)
- BestCoder Round #51 (div.2)