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()
- {
- // game loop
- while (1) {
- int spaceX;
- int spaceY;
- int mountainH; // represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right.
- cin >> spaceX >> spaceY; cin.ignore();
- int max_id = 0;
- int max_h = 0;
- for (int i = 0; i < 8; i++)
- {
- cin >> mountainH; cin.ignore();
- if (mountainH > max_h)
- {
- max_id = i;
- max_h = mountainH;
- }
- }
- // Write an action using cout. DON'T FORGET THE "<< endl"
- // To debug: cerr << "Debug messages..." << endl;
- cout << (spaceX == max_id ? "FIRE" : "HOLD") << endl; // either: FIRE (ship is firing its phase cannons) or HOLD (ship is not firing).
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement