12 条题解
-
0liangzhekai LV 7 @ 2024-9-22 16:31:49
#include<bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int a[N],n,maxx; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { int m=1,j=i; while(a[j+1]>a[j]) { m++; j++; } if(m>maxx) { maxx=m; } } cout<<maxx; return 0; }
-
02024-6-16 18:58:14@
#include<iostream> using namespace std; int main() { int a[100]; int n,cnt,maxn; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ if(a[i+1]>a[i]){ cnt++; maxn=max(cnt,maxn); } else cnt=1; } cout<<maxn; return 0; }
-
02023-9-10 11:18:29@
#include <bits/stdc++.h> using namespace std; const int N=1e7+10; const int INF=0x3f3f3f3f; int a[N],n,maxx; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { int m=1,j=i; while(a[j+1]>a[j]) { m++; j++; } if(m>maxx) { maxx=m; } } cout<<maxx; return 0; }
-
02023-4-2 20:16:38@
#include<bits/stdc++.h> using namespace std; int n,s=1,m=-10000,a[1000001]; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=2;i<=n;i++) if(a[i]>a[i-1]) s++; else { m=max(m,s); s=1; } cout<<m; return 0; }
-
02023-3-7 17:02:53@
#include <iostream> using namespace std; const int N=1e6+10; int a[N]; int main() { int n; cin >> n; int num = 0; for(int i = 1;i <= n;i++) { int maxn; if(a[i] > n) { maxn = a[i]; num++; } } cout << num; return 0; }
-
02023-2-19 15:17:13@
#include <bits/stdc++.h>
using namespace std;
int a[10000005];
int main(){
int n,sum = 1,maxn = -1;
for(int i=1;i <=n; i++) cin>>a[i];
for(int i=2;i <=n; i++){
if(a[i] > a[i - 1]) sum++;
else sum = 1;
maxn = max(sum,maxn);
}
cout<<maxn;
}
-
02022-12-11 9:45:26@
#include <iostream> #include <queue> #include <stdio.h> #include <stack> #include <math.h> #include <algorithm> #include <vector> #include <iomanip> #include <string.h> #define LL long long using namespace std; const int N = 1e6 + 10; const int INF = 0x3f3f3f3f; int n; int main() { cin >> n; int ans = 0, maxx = -INF; for(int i = 1, x, y; i <= n; i++) { y = x;//令y等于上一个 cin >> x; if(x > y)//上一个与下一个比较 { ans++;//天数增加 maxx = max(maxx, ans);//取天数最大值 } else { ans = 1;//重新计数 } } cout << maxx << endl;//最大天数 return 0; }
-
02022-11-12 13:26:05@
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; const int N=1e6+10; int a[N]; int main() { int n; cin >> n; int num = 0; for(int i = 1;i <= n;i++) { int maxn; if(a[i] > n) { maxn = a[i]; num++; } } cout << num; return 0; }
-
02022-8-18 20:41:57@
#include <queue>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <iomanip>
#include <string.h>
#include <algorithm>
using namespace std;
#define LL long long
const int N = 1e6 + 10;
const int INF = 0x3f3f3f3f;
int a[N];
int main()
{
int n; cin >> n; for(int i= 1;i <= n ; i++) cin >> a[i]; int len = 1, ans = 0; for(int i = 2; i <= n ; i++) { if(a[i] > a[i-1]) { len++; } else { len = 1; } ans = max(len , ans); } cout << ans << endl; return 0;
}
-
02022-8-5 20:29:16@
#include <iostream>
using namespace std;
int a[105]
int main()
{
int n; cin >> n; for(int i = 1;i <= n;i++) { int maxn; int num = 0; if(a[i] > n) { maxn = a[i]; num++; } } cout << num << endl; return 0;
}
-
-32022-10-15 11:20:07@
#include<iostream> #include<iomanip> #include<cstring> #include<string> #include<sstream> #include<cstdio> #include<cmath> #include<cstdlib> #include<queue> #include<vector> #include<algorithm> #include<stack> #include<fstream> #include<cstdlib> #include<ctime> #include<bits/stdc++.h> #define ll long long const int N=1e5+10; const int INF=0x3f3f3f3f; using namespace std; int main(){ int n,a[1000000],max=-1,i=0,j=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } while(i<n){ while(i<n&&a[i]==a[j]) i++; if(max<i-j) max=i-j; j=i; } cout<<max; return 0; }
-
-62022-4-23 10:37:53@
#include <iostream> using namespace std; a[105] int main() { int n; cin >> n; for(int i = 1;i <= n;i++) { int maxn; int num = 0; if(a[i] > n) { maxn = a[i]; num++; } } cout << num << endl; return 0; }
- 1
信息
- ID
- 1020
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 955
- 已通过
- 327
- 上传者