Created
January 23, 2015 18:41
-
-
Save anonymous/8a971b296e9715cfff2b to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
from math import sqrt, ceil | |
def main(): | |
def ans(r2, k): | |
count = 0 | |
for x in xrange(int(ceil(sqrt(r2)))): | |
if sqrt(r2 - x*x).is_integer(): | |
count += 4 | |
if count > k: | |
return 'impossible' | |
return 'possible' | |
for _ in xrange(int(raw_input())): | |
print ans(*map(int, raw_input().split())) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment