Advertisement
Flaron

ProgMasters_SpaceShip

Nov 6th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5.  
  6. Scanner sc = new Scanner(System.in);
  7.  
  8. int sor = 0;
  9. int x=-1;
  10. int y=-1;
  11. while (sc.hasNextLine()) {
  12. //bekérek egy sort
  13. String egySor = sc.nextLine();
  14. //ha van benne "X", hányadik elem
  15. int vanX = egySor.indexOf("X");
  16. if (vanX >= 0) {
  17. x = vanX;
  18. y = sor;
  19. }
  20. sor += 1;
  21. }
  22. if ( x== -1) {
  23. System.out.println("Spaceship lost forever.");
  24. } else
  25. System.out.println("[" + x + "," + (sor - y - 1) + "]");
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement