fork download
  1. #include <stdio.h>
  2. #define min(a,b) a>b?b:a
  3. int main(void) {
  4. // your code goes here
  5. int t,n,maxsp[10001],i,speed[10001];
  6. scanf("%d",&t);
  7. while(t--)
  8. {
  9. scanf("%d",&n);
  10. for(i=1;i<=n;i++)
  11. {
  12. scanf("%d",&maxsp[i]);
  13. }
  14. long long ans=0;
  15. speed[1]=maxsp[1];
  16. for(i=2;i<=n;i++)
  17. {
  18. speed[i]=min(maxsp[i],maxsp[i-1]);
  19. }
  20. for(i=1;i<=n;i++)
  21. {
  22. if(speed[i]==maxsp[i])
  23. ans++;
  24. }
  25. printf("%lld\n",ans);
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 2252KB
stdin
4
1
10
3
8 3 6
5
4 5 1 2 3
6
6 5 7 4 5 8
stdout
1
2
2
3