yyuny17 @ 2024-12-17 20:36:19
#include<bits/stdc++.h>
using namespace std;
int a[343434];
int main(){
int n,k;
cin>>n>>k;
int mi=100000,mx=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
mi=min(mi,a[i]);
mx=max(mx,a[i]);
}
for(int i=0;i<n;i++)
{
if(a[i]>=mi&&a[i]<k)cout<<mi<<' ';
if(a[i]<=mx&&a[i]>k)cout<<mx<<' ';
else cout<<a[i]<<' ';
}
return 0;
}
by pika_ @ 2024-12-17 20:42:38
找不同qwq
#include<bits/stdc++.h>
using namespace std;
int a[343434];
int main(){
int n,k;
cin>>n>>k;
int mi=100000,mx=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
mi=min(mi,a[i]);
mx=max(mx,a[i]);
}
for(int i=0;i<n;i++)
{
if(a[i]>=mi&&a[i]<k)cout<<mi<<' ';
else if(a[i]<=mx&&a[i]>k)cout<<mx<<' ';
else cout<<a[i]<<' ';
}
return 0;
}
by yyuny17 @ 2024-12-18 21:18:09
@pika_......(无语)
by yyuny17 @ 2024-12-18 21:20:20
@pika_谢谢
by pika_ @ 2024-12-18 21:39:04
awa