题目描述

A sequence contains n integers, can you make a judgment of whether the sequence is strictly increasing.

输入描述:

There are multiple test cases. The first line is an positive integer indicating the number of test cases.
For each test case:
Line 1. A positive integer n, standing for the number of elements in the sequence.
Line 2. This line contains n integers, a1, a2, ..., an(2<=n<=100, 0<=ai<=1000) separated by space.

输出描述:

For each test case, output one line. If the sequence is strictly increasing, print "Yes", else print "No".

数组中,若出现“后一个数大于等于前一个数”,则该数组非递增
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int t;
    cin>>t;
    int n,sum;
    while(t--)
    {
        vector<int> a;
        bool flag=true;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>sum;
            a.push_back(sum);
        }
        for(int i=0;i<n-1;i++)
        {
            if(a[i]>=a[i+1]) 
            {
                flag=false;
                cout<<"No"<<endl;
                break;
            }
        }
        if(flag) cout<<"Yes"<<endl;
    }
    return 0;
}