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;
- string fire;
- int maxH=0;
- int n = 0;
- cin >> spaceX >> spaceY; cin.ignore();
- for (int i = 0; i < 8; i++) {
- int mountainH; // represents the height of one mountain, from 9 to 0. Mountain heights are provided from left to right.
- cin >> mountainH; cin.ignore();
- if(maxH<mountainH){
- maxH=mountainH;
- n=i;
- }
- }
- cerr<<maxH<<" "<<spaceY<<" "<<spaceX<<" "<<n<<endl;
- if(spaceX==n){
- fire="FIRE";
- }else{
- fire="HOLD";
- }
- // Write an action using cout. DON'T FORGET THE "<< endl"
- // To debug: cerr << "Debug messages..." << endl;
- cout << fire << 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