QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100

#16115. لعبة المجموع

Statistics

تلعب Ana و Bob اللعبة التالية.

أولًا، يختار Bob متتالية من $n$ من الأعداد الصحيحة الموجبة $a_1, a_2, \dots, a_n$. ثم يُسمح لـ Ana بإجراء العمليات التالية.

  • يمكنها مسح أي من الأعداد من المتتالية، ولكن لا يُسمح لها بمسحها جميعًا (يجب أن يبقى عدد واحد على الأقل).
  • لكل عدد متبقٍّ، يمكنها وضع إشارة + أو - أمامه.

بعد ذلك، تحسب Ana مجموع الأعداد المتبقية. تفوز باللعبة إذا تمكنت من الحصول على مجموع يقبل القسمة على $m$. وإلا يفوز Bob.

بإعطائك $n$ و $m$، حدد أي لاعب لديه استراتيجية رابحة.

الإدخال

يحتوي السطر الأول على عدد صحيح واحد $t$ — عدد حالات الاختبار. يحتوي كل سطر من الأسطر الـ $t$ التالية على عددين صحيحين $n$ و $m$.

الإخراج

لكل حالة اختبار، اطبع سطرًا واحدًا.

  • Ana — إذا كانت لدى Ana استراتيجية رابحة،
  • Bob — إذا كانت لدى Bob استراتيجية رابحة.

القيود

$1 \le t \le 10^5$, $1 \le n, m \le 10^{18}$.

أمثلة

الإدخال 1

3
1 2
2 3
3 8

الإخراج 1

Bob
Ana
Bob

ملاحظة

في حالة الاختبار الأولى، يمكن لـ Bob اختيار $a_1 = 3$. في حالة الاختبار الثانية، بغض النظر عن كيفية اختيار Bob للعددين $a_1, a_2$، فإن لدى Ana استراتيجية رابحة.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.