fork download
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int T;
  6. cin>>T;
  7. while(T)
  8. {
  9. int N;
  10. cin>>N;
  11. int a[N];
  12. for(int i1=0;i1<N;i1++)
  13. {
  14. cin>>a[i1];
  15. }
  16. int p,s=1;
  17. for(int i=0;i<N-1;i++)
  18. {
  19. if(a[i]>=a[i+1])
  20. {
  21. s=s+1;
  22. }
  23. else
  24. {
  25. p=a[i];
  26. a[i+1]=p;
  27. }
  28. }
  29. cout<<s<<endl;
  30. T--;
  31. }
  32. }
  33.  
Success #stdin #stdout 0s 3300KB
stdin
3
1
10
3
8 3 6
5
4 5 1 2 3
stdout
1
2
2