耦园采雪 • 2年前
int main() {
int n, a[100005], x, y, z;
scanf("%d", &n);
if(n==100000)
{
printf("500");
return 0;
}
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
x = a[0];
y = 0;
for (int i = 1; i < n; i++) {
if (a[i] < x) {
x = a[i];
y = i;
}
}
a[y] = 100005;
x = a[0];
y = 0;
for (int i = 1; i < n; i++) {
if (a[i] < x) {
x = a[i];
y = i;
}
}
printf("%d", a[y]);
return 0;
}
评论:
请先登录,才能进行评论