Introduction
Today I woud like to play some game. so I picked up "Logic summoner" created by "Paiza" that is Japanese campany named "GINO".
株式会社ギノさんが提供しているゲーム「ロジックサマナー」をやってみようと思います、
Getting started
Access this page. and rest user to paiza. then you can play this game.
Now Play!(やってみました)
why tihis code is wrong?(なんでふせいかいなのか?)
mission is out "4 2 1 3 5\n"(左のように出力するのが問題)
import java.util.*; public class Main { public static void main(String[] args) { // 自分の得意な言語で // Let's チャレンジ!! Scanner sc = new Scanner(System.in); String line = sc.nextLine(); int num = Integer.parseInt(line); LinkedList<Integer> list = new LinkedList<>(); char[] arr = sc.nextLine().toCharArray(); int count = 1; for (int i = 0; i < arr.length; i++) { char c = arr[i]; if ('L' == c) { list.offerFirst(count); } else if ('R' == c) { list.offerLast(count); } else { } count++; } int c1 = 0; for (Integer o : list) { if (c1 == list.size() -1) { System.out.println(String.valueOf(o)); } else { System.out.print(String.valueOf(o) + " "); } } } }
Result(結論)
It is good Question but Answer is ???
プログラムの問題自体は面白かったけど答えがイマイチ・・・