#include <iostream> using namespace std; string nimGame(int a, int b, int c) { int xorSum = a ^ b ^ c; if (xorSum == 0) { return "1"; } else { int departments[3] = {a, b, c}; string names[3] = {"A", "B", "C"}; for (int i = 0; i < 3; ++i) { for (int j = 1; j <= departments[i]; ++j) { int newSum = xorSum ^ departments[i] ^ (departments[i] - j); if (newSum == 0) { return names[i] + "," + to_string(j); // 返回最优策略 } } } } return "No solution!"; } int main() { int a, b, c; char comma; // 用于读取逗号 cin >> a >> comma >> b >> comma >> c; cout << nimGame(a, b, c) << endl; return 0; } // 64 位输出请用 printf("%lld")