GGMPL

Nalezy Do Odcinka

Oct 24th, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool nalezyDoOdcinka(int x, int y) {
  5.     if (x*y!=x*x) return false;
  6.     if ((x == 0 && y != 0) || (x!=0 && y == 0)) return false;
  7.     if (x >= -10 && x <= 10 && y >= -10 && y <= 10) return true;
  8.     return false;
  9. }
  10.  
  11.  
  12. struct punkty {
  13.     //AB
  14.     int xA[100], yA[100];
  15. } pkt;
  16.  
  17.  
  18. int main()
  19. {
  20.     int A = 0;
  21.  
  22.     for (int i = 0; i < 100; i++) cin >> pkt.xA[i];
  23.     for (int i = 0; i < 100; i++) cin >> pkt.yA[i];
  24.     for (int i = 0; i < 100; i++) if (nalezyDoOdcinka(pkt.xA[i], pkt.yA[i])) A++;
  25.     cout << "A = " << A << endl;
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment