Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <fstream>
  2. #include <set>
  3.  
  4. using namespace std;
  5.  
  6. long double x, y;
  7. long long n, ans;
  8. set<pair<int, int>> s;
  9.  
  10. ifstream fin("input.txt");
  11. ofstream fout("output.txt");
  12.  
  13. int gcd (int a, int b) {
  14. return b ? gcd (b, a % b) : a;
  15. }
  16.  
  17. int main()
  18. {
  19. ios::sync_with_stdio(0);
  20. fin >> n;
  21. for (int i = 0; i < n; i++)
  22. {
  23. fin >> x >> y;
  24. int g = gcd(x, y);
  25. s.insert(make_pair(x / g, y / g));
  26. }
  27. fout << s.size();
  28. system("pause");
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement