Created
November 14, 2015 12:05
-
-
Save jeehoonkang/61a8b1e3bd5ff7f173d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
int main() { | |
setbuf(stdout, NULL); | |
int nCase; | |
scanf("%d", &nCase); | |
for (int iCase = 0; iCase < nCase; ++iCase) { | |
long long a, b, c; | |
printf("Case #%d\n", iCase + 1); | |
scanf("%lld %lld %lld", &a, &b, &c); | |
while (c-- > 0) { | |
long long n, k; | |
scanf("%lld %lld", &n, &k); | |
long long t = a * k + b; | |
long long u = b * k + a; | |
long long x = n / t; | |
long long y = n % t; | |
if (y <= a && x * (t - u) < y) { | |
printf("b"); | |
} else { | |
printf("a"); | |
} | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment