VioletaBabel

The Descent 본문

알고리즘문제들/codingame
The Descent
Beabletoet 2018. 2. 21. 17:30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int mh[8], target, th;
    while (1
    {
        target = 0;
        th = 0;
        for (int i = 0; i < 8; i++
        {
            int mountainH; // represents the height of one mountain.
            cin >> mountainH; cin.ignore();
            mh[i] = mountainH;
        }
        for(int i = 0; i < 8++i)
            if(mh[i] > th)
            {
                target = i;
                th = mh[i];
            }
        cout<<target<<endl;
    }
}
cs


'알고리즘문제들 > codingame' 카테고리의 다른 글

Temperatures  (0) 2018.02.21
Power of Thor - Episode 1  (0) 2018.02.21
Comments