Advertisement
xTheEc0

CodinGame.com // Mars lander - Level 1 // Easy

Oct 22nd, 2015
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. /**
  9.  * Auto-generated code below aims at helping you parse
  10.  * the standard input according to the problem statement.
  11.  **/
  12. int main()
  13. {
  14.     int surfaceN; // the number of points used to draw the surface of Mars.
  15.     int X;  //Coordinates of the mars lander
  16.     int Y;  // ^^
  17.     int hSpeed; // the horizontal speed (in m/s), can be negative.
  18.     int vSpeed; // the vertical speed (in m/s), can be negative.
  19.     int fuel; // the quantity of remaining fuel in liters.
  20.     int rotate; // the rotation angle in degrees (-90 to 90).
  21.     int power; // the thrust power (0 to 4).
  22.     int landX; // X coordinate of a surface point. (0 to 6999)
  23.     int landY; // Y coordinate of a surface point. By linking all the points together in a sequential fashion, you form the surface of Mars.    
  24.    
  25.     cin >> surfaceN; cin.ignore();
  26.     for (int i = 0; i < surfaceN; i++) {
  27.         cin >> landX >> landY; cin.ignore();
  28.     }
  29.  
  30.     // game loop
  31.     while (1) {
  32.        
  33.         cin >> X >> Y >> hSpeed >> vSpeed >> fuel >> rotate >> power; cin.ignore();
  34.  
  35.         // Write an action using cout. DON'T FORGET THE "<< endl"
  36.         // To debug: cerr << "Debug messages..." << endl;
  37.    
  38.         if (Y < 3500){
  39.             if (vSpeed <= -40) cout << "0 4" << endl;
  40.             if (vSpeed > -40) cout << "0 0" << endl;
  41.         }
  42.         else cout << "0 0" << endl;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement