SHARE
TWEET

Untitled

a guest Oct 15th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <set>
  3. #include <string>
  4. #include <vector>
  5. #include <iomanip>
  6. #include <algorithm> // для sort
  7. #include <math.h>    /* round, floor, ceil, trunc */
  8. using namespace std;
  9. typedef long long ll;
  10.  
  11. int main(){
  12.  
  13. ll n, k, temp, min = 301, c=1;
  14. cin >> n >> k;
  15. vector <ll> a;
  16. for(int i = 0; i < n; i++){
  17.        cin >> temp;
  18.        a.push_back(temp);
  19. }
  20. for(int i = 2; i < n; i++){
  21.        if((a[i] + a[i-1] + a[i-2] < min)){
  22.               min = a[i] + a[i-1] + a[i-2];
  23.               c = i;
  24.        }
  25. }
  26. c-=1;
  27. cout << c;
  28.   return 0;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top