Alex_tz307

Classic - Level 1

Oct 30th, 2020 (edited)
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("text.in");
  6. ofstream fout("text.out");
  7.  
  8. int main() {
  9.     fin.sync_with_stdio(false);
  10.     fout.sync_with_stdio(false);
  11.     fin.tie(nullptr);
  12.     fout.tie(nullptr);
  13.     int N;
  14.     fin >> N;
  15.     vector < int > a(N);
  16.     int mn = INT_MAX, ans = -1;
  17.     for(int i = 0; i < N; ++i) {
  18.         fin >> a[i];
  19.         if(a[i] < mn) {
  20.             mn = a[i];
  21.             ans = i;
  22.         }
  23.     }
  24.     fout << ans;
  25. }
  26.  
Add Comment
Please, Sign In to add comment