mirror of
https://github.com/mx42/codingame.git
synced 2026-01-14 05:39:51 +01:00
36 lines
855 B
C++
36 lines
855 B
C++
// https://www.codingame.com/ide/puzzle/the-descent
|
|
// Xavier Morel - 2016-03-12
|
|
|
|
#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()
|
|
{
|
|
|
|
// game loop
|
|
while (1) {
|
|
int v = 0, r = 0;
|
|
for (int i = 0; i < 8; i++) {
|
|
int mountainH; // represents the height of one mountain, from 9 to 0.
|
|
cin >> mountainH; cin.ignore();
|
|
if (mountainH > v) {
|
|
r = i;
|
|
v = mountainH;
|
|
}
|
|
}
|
|
|
|
// Write an action using cout. DON'T FORGET THE "<< endl"
|
|
// To debug: cerr << "Debug messages..." << endl;
|
|
|
|
cout << r << endl; // The number of the mountain to fire on.
|
|
}
|
|
}
|