fork download
  1. # your code goes here
  2. # there is some problem with this code i mean even for some non traingles it will print TRUE i will remove that problem soon till that this can be used as an idea to work ahead
  3. import sys
  4. import math
  5. f = sys.stdin
  6. t = int(f.readline())
  7. while t:
  8. a,b,c = [int(x) for x in (f.readline().split())] # considering points are given in sorted order
  9. dist1 = c-b+1
  10. lev1 = (-1+int(math.sqrt(1+8*a)))/2
  11. if (lev1*(lev1+1)/2) < a:
  12. lev1 += 1
  13. lev2 = (-1+int(math.sqrt(1+8*b)))/2
  14. if (lev2*(lev2+1)/2) < b:
  15. lev2 += 1
  16. lev3 = (-1+int(math.sqrt(1+8*c)))/2
  17. if (lev3*(lev3+1)/2) < c:
  18. lev3 += 1
  19. dist2 = lev2-lev1+1
  20. dist3 = lev3-lev1+1
  21. print dist1 , dist2 , dist3
  22. if dist1 == dist2 and dist1 == dist3 and dist1!=0:
  23. print "TRUE"
  24. else :
  25. print "FALSE"
  26. t-=1
Success #stdin #stdout 0.01s 7856KB
stdin
1
5 13 15 
stdout
3 3 3
TRUE