fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int t,s;
  5. scanf("%d",&t); scanf("%ld", &s);
  6. int i,j;
  7. long int moments[s],cookingtime[s],comparison[s];
  8. for(i=0;i<t;i++) {
  9. for(j=0;j<1;j++) {
  10. scanf("%ld", &moments[j]);
  11. comparison[j]=moments[j];
  12. scanf("%ld",&cookingtime[j]); }
  13. for(j=1;j<s;j++) {
  14. scanf("%ld", &moments[j]);
  15. comparison[j]=(moments[j]-moments[j-1]);
  16. scanf("%ld",&cookingtime[j]); }
  17. long int count=0;
  18. for(j=0;j<s;j++) {
  19. if(comparison[j]>=cookingtime[j]) { count++; }
  20. }
  21. printf("%ld \n",count);
  22. }
  23. return 0;
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
Success #stdin #stdout 0s 2160KB
stdin
1
5
12 20 35
10 5 20
stdout
3