看到本题,想必大家都用for循环去获得每一位的数字,然后去跟其他位作比较,得到最小的答案(min),当然,我与一种最简单的方法,或许你也想到了,直接上代码!
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e2 + 10;
const int mod = 998244353;
const int inf = 1e9 + 10;
void customize_swap(int &swap_variable_1,int &swap_variable_2){
int tp = swap_variable_1;
swap_variable_1 = swap_variable_2;
swap_variable_2 = tp;
}
void solve(){
int n; cin >> n;
vector<int> v(n);
for(int i = 0;i < n;i++) cin >> v[i];
sort(v.begin(),v.end());
cout << v[0] << endl;
}
signed main(){
int t = 1;
while(t--) solve();
return 0;
}