2 条题解
- 
  0Infinity_ LV 8 @ 2024-08-23 18:14:22 #include<bits/stdc++.h> #define x INT_MIN using namespace std; int a[10010], b[10010]; int main(){ ios::sync_with_stdio(false); int n, m; cin >> n >> m; a[0] = x; a[n+1] = x; b[0] = x; b[m+1] = x; for(int i = 1; i <= n; i++)cin >> a[i]; for(int i = 1; i <= m; i++)cin >> b[i]; for(int i = 1; i <= n; i++){ if(a[i] > a[i+1])cout << a[i] << ' '; } cout << endl; for(int i = 1; i <= m; i++){ if(b[i] > b[i+1])cout << b[i] << ' '; } return 0; }
- 
  0@ 2023-08-25 16:16:39#include<bits/stdc++.h> 
 using namespace std;
 int a[10001],b[10001],n,m;
 void Findmax(int x[],int i,int n)
 {
 if(i==n)
 {
 cout<<x[i]<<' ';
 return;
 }
 if(x[i]>x[i-1]&&x[i]>x[i+1])cout<<x[i]<<' ';
 return Findmax(x,i+1,n);
 }
 int main()
 {
 cin>>n>>m;
 for(int i=1;i<=n;i++)cin>>a[i];
 for(int i=1;i<=m;i++)cin>>b[i];
 Findmax(a,1,n);
 cout<<endl;
 Findmax(b,1,m);
 return 0;
 }
 //6我查到的资料里好像没说最后一个默认就是啊
 //为了过这题只能这样
- 1
信息
- ID
- 1052
- 难度
- 3
- 分类
- (无)
- 标签
- 递交数
- 114
- 已通过
- 53
- 通过率
- 46%
- 上传者