1 条题解

  • 0
    @ 2023-1-21 21:36:57
    #include<bits/stdc++.h>
    using namespace std;
    //n是10^6,a数组是10^9所以用Long long
    long long a[1000000];
    int main()
    {
    	int n, t = 1, ans = 0;
    	cin >> n; 
    	for (int i = 0; i < n; i++){
    		cin >> a[i];
    	} 
    	for(int j = 0; j < n; j++){
    		if(a[j+1] > a[j]){
    			t++;//如果比第一个大,则加一
    			if(t > ans){
    				ans = t;//把最大的连续上升天数放在ans里 
    			} 
    		}
    		else t = 1; //否则t又变成1 
    	}
    	cout << ans; 
    	return 0;
    }
    
    
    
    • 1

    信息

    ID
    458
    时间
    1000ms
    内存
    128MiB
    难度
    2
    标签
    递交数
    39
    已通过
    26
    上传者