@6069
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, sum;
sum = -2100000000;
cin >> x;
int a[x + 5];
for (int i = 1; i <= x; i++) {
cin >> a[i];
if (a[i] > sum)
sum = a[i];
}
for (int i = 1; i <= x; i++) {
if (a[i] == sum) {
cout << i;
break;
}
}
}
共 1 条回复
@6069 #include <bits/stdc++.h> using namespace std; int main() { int x, sum; sum = -2100000000; cin >> x; int a[x + 5]; for (int i = 1; i <= x; i++) { cin >> a[i]; if (a[i] > sum) sum = a[i]; } for (int i = 1; i <= x; i++) { if (a[i] == sum) { cout << i; break; } } }