Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- using namespace std;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- int main()
- {
- int array[8] = {0,0,0,0,0,0,0,0,};
- int max;
- // game loop
- while (1) {
- for (int i = 0; i < 8; i++) {
- int mountainH; // represents the height of one mountain, from 9 to 0.
- cin >> mountainH; cin.ignore();
- if (i == 0)
- { max = i;}
- else
- {if (mountainH > array[max])
- max = i;}
- array[i] = mountainH;
- }
- // Write an action using cout. DON'T FORGET THE "<< endl"
- // To debug: cerr << "Debug messages..." << endl;
- cout << max << endl;// The number of the mountain to fire on.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement