fork download
  1. t = Integer(gets)
  2. while t > 0
  3. a4 = []
  4. a7 = []
  5. n = Integer(gets)
  6. i = a4.length + 1
  7. if n > a4.length
  8. while i <= n
  9. a4 << i.to_s.count("4")
  10. a7 << i.to_s.count("7")
  11.  
  12. i = i + 1
  13. end
  14. end
  15. count = 0
  16. i = 1
  17. while (a4[i] == a7[i])
  18. i =i + 1
  19. end
  20. count = i*(i+1)2
  21. print "#{count}\n"
  22. t = t - 1
  23. end
Runtime error #stdin #stdout 0s 4760KB
stdin
3
3
10
100
stdout
Standard output is empty