結果
| 問題 |
No.8 N言っちゃダメゲーム
|
| ユーザー |
vjudge1
|
| 提出日時 | 2025-09-05 08:51:08 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 64 ms / 5,000 ms |
| コード長 | 1,445 bytes |
| コンパイル時間 | 7,452 ms |
| コンパイル使用メモリ | 79,872 KB |
| 実行使用メモリ | 43,712 KB |
| 最終ジャッジ日時 | 2025-09-05 08:51:17 |
| 合計ジャッジ時間 | 4,795 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
FastReader fr = new FastReader();
PrintWriter pw = new PrintWriter(System.out);
int p = fr.nextInt();
for (int t = 0; t < p; t++) {
int n = fr.nextInt();
int k = fr.nextInt();
// Fast bit manipulation alternative to modulo
if (k == 0) {
pw.println((n & 1) == 1 ? "Win" : "Lose");
} else {
int remainder = (n - 1) % (k + 1);
pw.println(remainder == 0 ? "Lose" : "Win");
}
}
pw.flush();
pw.close();
}
// Custom Fast Reader class for fastest input
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
}
vjudge1