結果

問題 No.8 N言っちゃダメゲーム
ユーザー mitsuomitsuo
提出日時 2016-05-07 20:29:21
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 880 bytes
コンパイル時間 2,225 ms
コンパイル使用メモリ 79,436 KB
実行使用メモリ 54,624 KB
最終ジャッジ日時 2024-04-15 13:38:57
合計ジャッジ時間 4,403 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,312 KB
testcase_01 AC 131 ms
41,544 KB
testcase_02 AC 130 ms
41,592 KB
testcase_03 AC 144 ms
41,576 KB
testcase_04 AC 139 ms
41,456 KB
testcase_05 AC 141 ms
41,452 KB
testcase_06 WA -
testcase_07 AC 143 ms
41,804 KB
testcase_08 AC 142 ms
41,588 KB
testcase_09 AC 142 ms
41,800 KB
testcase_10 AC 139 ms
41,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 <= 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();

	}
}
0