fork download
  1. #include <iostream>
  2. using namespace std;
  3. struct archerProfile {
  4. unsigned long x;
  5. unsigned long r;
  6. unsigned int c;
  7. }archer[1000];
  8. int main(){
  9. int n;
  10. int commands = 1;
  11. cin >> n;
  12. for (int i = 0; i < n; i++) {
  13. cin >> archer[i].x >> archer[i].r >> archer[i].c;
  14. }
  15. for (int i = 0; i < n - 1; i++) {
  16. unsigned long long distanceBetweenArchers = archer[i + 1].x - archer[i].x;
  17. if (distanceBetweenArchers > archer[i].c * archer[i].r) {
  18. commands += 1;
  19. }
  20. }
  21. cout << commands;
  22. return 0;
  23. }
Success #stdin #stdout 0s 4504KB
stdin
5
1 3 3
5 1 2
8 2 3
10 1 2
11 3 2
stdout
2