'commit'
This commit is contained in:
25
TangDou/LuoGuBook/4_1_2.cpp
Normal file
25
TangDou/LuoGuBook/4_1_2.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
/**
|
||||
* 测试用例:
|
||||
5
|
||||
4 10 21 3 12
|
||||
* @return
|
||||
*/
|
||||
|
||||
using namespace std;
|
||||
int n, x;
|
||||
|
||||
int MaxV, MaxP;
|
||||
int MinV, MinP;
|
||||
int main() {
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> x;
|
||||
if (x > MaxV) MaxV = x, MaxP = i;
|
||||
if (x < MinV) MinV = x, MinP = i;
|
||||
}
|
||||
cout << MaxV << " " << MaxP << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user