文章
37
粉丝
98
获赞
4
访问
22.8k
#include<iostream>
#include<algorithm>
#include<random>
#include<string>
#include<time.h>
using namespace std;
int main()
{
int n;
int a[100];
cin >> n;
int flag[100] = { 0 };
int minIndex, maxIndex;
int min = 9999, max = -9999;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] > max) {
max = a[i];
maxIndex = i;
}
if (a[i] <= min) {//保证了最大值和最小值不指向同一个数
min = a[i];
minIndex = i;
 ...
登录后发布评论
暂无评论,来抢沙发