Advertisement
tanasaradu

Untitled

Nov 8th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int NMAX=1001;
  4. struct TR
  5. {
  6. int ox,oy,c;
  7. };
  8. TR a[NMAX];
  9. int T,C,N;
  10. int main()
  11. {
  12. int cnt=0,sol,t;
  13. double x,y;
  14. cin>>T>>C>>N;
  15. for(int i=1; i<=N; i++)
  16. cin>>a[i].ox>>a[i].oy>>a[i].c;
  17. while(T--)
  18. {
  19. sol=0;
  20. for(int i=1; i<=N; i++)
  21. {
  22. t=a[i].oy-a[i].c*cnt;
  23. x=(double)(a[i].ox)/C;
  24. y=(double)t/a[i].c;
  25. sol+=(x==y);
  26. }
  27. cout<<sol<<"\n";
  28. ++cnt;
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement