結果
問題 | No.2103 ±1s Game |
ユーザー |
![]() |
提出日時 | 2024-07-18 18:15:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 609 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 39,808 KB |
最終ジャッジ日時 | 2025-02-23 16:12:36 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:30:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%d%d%d%d", &x, &y, &k, &p); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2103.cc: No.2103 ツア1s Game - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* subroutines */ bool check(int x, int y, int k, int p) { int n = x + y - k; if (n & 1) { bool f1 = check(x - 1, y, k, -p) && check(x, y - 1, k, -p); return ! f1; } int h = n / 2; if (y <= h) return p > 0; if (x <= h) return ((k & 1) == (p > 0 ? 0 : 1)); return false; } /* main */ int main() { int x, y, k, p; scanf("%d%d%d%d", &x, &y, &k, &p); bool f0 = check(x, y, k, p); if (f0) puts("Alice"); else puts("Bob"); return 0; }