From 9bf99f989987f96f68e622181db9d185365b9302 Mon Sep 17 00:00:00 2001 From: Sameer Shrivastava <56542430+UltralegendSam-Fs@users.noreply.github.com> Date: Thu, 1 Oct 2020 12:25:24 +0530 Subject: [PATCH] =?UTF-8?q?Create=20=20=E2=80=98Circle=20City=E2=80=99=20S?= =?UTF-8?q?olution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...42\200\230Circle City\342\200\231 Solution" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "python/\342\200\230Circle City\342\200\231 Solution" diff --git "a/python/\342\200\230Circle City\342\200\231 Solution" "b/python/\342\200\230Circle City\342\200\231 Solution" new file mode 100644 index 0000000..8fc0757 --- /dev/null +++ "b/python/\342\200\230Circle City\342\200\231 Solution" @@ -0,0 +1,18 @@ +from math import sqrt, ceil + +def isCircleProtected(d, K): + count = 0 + for m in xrange(int(ceil(sqrt(d)))): + if sqrt(d - m*m).is_integer(): + count += 4 + + return count <= K + +if __name__ == '__main__': + t = input() + for _ in range(t): + d, k = map(int, raw_input().split()) + if (isCircleProtected(d, k)): + print "possible" + else: + print "impossible"