Advertisement
Sinux1

The Descent ; Codingame

Mar 6th, 2016
649
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. /**
  9.  * Auto-generated code below aims at helping you parse
  10.  * the standard input according to the problem statement.
  11.  **/
  12. int main()
  13. {
  14. int array[8] = {0,0,0,0,0,0,0,0,};
  15. int max;
  16.  
  17.     // game loop
  18.     while (1) {
  19.         for (int i = 0; i < 8; i++) {
  20.             int mountainH; // represents the height of one mountain, from 9 to 0.
  21.             cin >> mountainH; cin.ignore();
  22.             if (i == 0)
  23.                { max = i;}
  24.             else
  25.                 {if (mountainH > array[max])
  26.                     max = i;}
  27.            
  28.             array[i] = mountainH;
  29.            
  30.         }
  31.            
  32.            
  33.  
  34.         // Write an action using cout. DON'T FORGET THE "<< endl"
  35.         // To debug: cerr << "Debug messages..." << endl;
  36.  
  37.          cout << max << endl;// The number of the mountain to fire on.
  38.     }
  39.    
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement