Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.IO;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- class Player
- {
- static int SpeedSum(int a)
- {
- int sum=(1+a)*a/2;
- return sum;
- }
- static void Main(string[] args)
- {
- int road = int.Parse(Console.ReadLine()); // the length of the road before the gap.
- int gap = int.Parse(Console.ReadLine()); // the length of the gap.
- int platform = int.Parse(Console.ReadLine()); // the length of the landing platform.
- int OptimalSpeed = gap + 1;
- int PositionToSpeedUp = road - SpeedSum(OptimalSpeed)-4;
- if (PositionToSpeedUp<0)
- {
- PositionToSpeedUp = 0;
- }
- bool jump = false; //jump has been performed indicator
- // game loop
- while (true)
- {
- int speed = int.Parse(Console.ReadLine()); // the motorbike's speed.
- int coordX = int.Parse(Console.ReadLine()); // the position on the road of the motorbike.
- // Write an action using Console.WriteLine()
- // To debug: Console.Error.WriteLine("Debug messages...");
- // A single line containing one of 4 keywords: SPEED, SLOW, JUMP, WAIT.
- Console.Error.WriteLine("длина дороги: {0}",road);
- Console.Error.WriteLine("пропасть: {0}",gap);
- Console.Error.WriteLine("платформа: {0}",platform);
- Console.Error.WriteLine("------------------------------------------------");
- Console.Error.WriteLine("координаты: {0}",coordX);
- Console.Error.WriteLine("когда газовать: {0}",PositionToSpeedUp);
- Console.Error.WriteLine("скорость: {0}",speed);
- Console.Error.WriteLine("оптимальная скорость: {0}",OptimalSpeed);
- //starting point
- if (coordX == 0 && speed == 0)
- {
- Console.WriteLine("SPEED");
- continue;
- }
- if (road - 2 ==coordX )
- {
- Console.WriteLine("JUMP");
- jump = true;
- continue;
- }
- if (coordX >= PositionToSpeedUp && speed < OptimalSpeed && jump ==false)
- {
- Console.WriteLine("SPEED");
- continue;
- }
- else if (jump == true)
- {
- Console.WriteLine("SLOW");
- continue;
- }
- else
- {
- Console.WriteLine("WAIT");
- continue;
- }
- //speed 1 test block
- /*
- if (coordX == 0 && speed == 0)
- {
- Console.WriteLine("SPEED");
- }
- Console.WriteLine("WAIT");
- */
- //Console.Error.WriteLine(road);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement