题解
【入门】温度统计
1 条题解
-
0
#include<bits/stdc++.h> using namespace std; int a[10001], b[10001]; int main() { int n; cin >> n; int c = 1, max = INT_MIN; // c is the current length of the increasing subarray // max keeps track of the maximum length for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 2; i <= n; i++) { if(a[i] > a[i-1]) { c++; } else { if(c > max) { max = c; } c = 1; // reset current length } } // Compare the length of the last subarray if(c > max) { max = c; } cout << max; return 0; }
- 1