Short Problem Definition:
That’s the value of pi! (Ignoring the floating point) A song is a pi song if the length of its words represent the value of pi.
Link
Complexity:
time complexity is O(N\*T)
space complexity is O(N)
Execution:
This problem is straight forward.
Solution:
#!/usr/bin/py
PI = map(int, list("31415926535897932384626433833"))
def isPiSong(s):
for idx, word in enumerate(s):
if len(word) != PI[idx]:
return False
return True
if __name__ == '__main__':
t = input()
for _ in range(t):
s = raw_input().split()
if isPiSong(s):
print "It's a pi song."
else:
print "It's not a pi song."