6 条题解
- 1
信息
- ID
- 636
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 5
- 标签
- 递交数
- 201
- 已通过
- 80
- 上传者
用函数,不迷路!
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
cout << max(a, max(b, max(c, max(d, e))));
cout << ' ' << min(a, min(b, min(c, min(d, e))));
return 0;
}
哪里有问题?
#include <iostream>
using namespace std;
int main()//头文件
{
int a[5],maxx=0,minn=100;
for (int i=0;i<5;i++)
{
cin >> a[i];
if (a[i]<minn)
{
minn=a[i];
}
if (a[i]>maxx)
{
maxx=a[i];
}
}
cout << maxx << ' ' << minn;
return 0;//结尾
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a , b , c , d , e;
cin >> a >> b >> c >> d >> e;
cout << max(a , max(b,max(c , max(d,e) ))) << " ";
cout << min(a , min(b,min(c , min(d,e) ))) << " ";
return 0;
}//A
#include <iostream>//hetao3097453
#include <algorithm>
using namespace std;
int main()
{
int a,b,c,d,e;
cin >> a >> b >> c >> d >> e;
int maxx = max(a, max(b, max(c, max(d, e))));
int minn = min(a, min(b, min(c, min(d, e))));
cout << maxx << " " << minn;
return 0;
}