/* -*- coding: utf-8 -*- * * 250.cc: No.250 atetubou恮zetubou - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_X = 1500; const int MAX_D = 1500; const int MAX_XD = MAX_X + MAX_D; typedef long long ll; const ll MAX_T = 1000000000000000LL; /* typedef */ /* global variables */ ll combs[MAX_XD][MAX_XD]; /* subroutines */ /* main */ int main() { for (int i = 0; i < MAX_XD; i++) { combs[i][0] = combs[i][i] = 1; for (int j = 1; j < i; j++) { if (combs[i - 1][j - 1] < MAX_T && combs[i - 1][j] < MAX_T) combs[i][j] = combs[i - 1][j - 1] + combs[i - 1][j]; else combs[i][j] = MAX_T + 1; } } int qn; cin >> qn; while (qn--) { int di, xi; ll ti; cin >> di >> xi >> ti; ll pn = combs[xi + di - 1][di - 1]; //printf("xi=%d, di=%d => pn=%lld, ti=%lld\n", xi, di, pn, ti); cout << (pn <= ti ? "AC" : "ZETUBOU") << endl; } return 0; }