結果
問題 |
No.8 N言っちゃダメゲーム
|
ユーザー |
|
提出日時 | 2016-05-07 20:36:31 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 995 bytes |
コンパイル時間 | 1,982 ms |
コンパイル使用メモリ | 79,684 KB |
実行使用メモリ | 54,140 KB |
最終ジャッジ日時 | 2024-10-05 10:23:57 |
合計ジャッジ時間 | 3,869 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 1 |
ソースコード
package jp.fedom.challange.yuki.l2.q8; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); List<String> input = new ArrayList<>(); while (sc.hasNext()) { input.add(sc.nextLine()); } System.out.println(solve(input)); sc.close(); } public static String solve(List<String> in) { int P = Integer.valueOf(in.get(0)); StringBuilder sb = new StringBuilder(); in.remove(0); for (String s : in) { int n = Integer.valueOf(s.split(" ")[0]); int k = Integer.valueOf(s.split(" ")[1]); if (n == 1) { sb.append("Lose"); } else if (k == 1) { sb.append(n % 2 == 0 ? "Win" : "Lose"); } else if (n <= k) { sb.append("Win"); } else { if ((n - 1) % (k + 1) == 1 || (n - 1) % (k + 1) == 0) { sb.append("Lose"); } else { sb.append("Win"); } } sb.append("\r\n"); } return sb.toString().trim(); } }