fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int t, n, k, temp, count;
  8. scanf("%d", &t);
  9. while(t--) {
  10. scanf("%d", &n);
  11. count=0;
  12. for(int i=0; i<n; i++) {
  13. scanf("%d", &k); if(i==0) temp=k;
  14. if(k<=temp) {
  15. temp=k; count++;
  16. }
  17. }
  18. cout<<count<<endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 3344KB
stdin
3
1
10
3
8 3 6
5
4 5 1 2 3
stdout
1
2
2