fork download
  1. list4 = [4, 44, 444, 4444, 44444]
  2. list7 = [7, 77, 777, 7777, 77777]
  3. list10 = [10, 100, 1000, 10000, 100000]
  4. result = 0
  5. results = []
  6.  
  7. x1 = 1
  8. x2 = 0
  9. for i in range(1, 100001):
  10. mod = i % 10
  11. if ((mod >= 4) and (mod < 7)):
  12. result += x2
  13. x2 += 1
  14. else:
  15. result += x1
  16. x1 += 1
  17. results.append(result)
  18.  
  19. t = int(input(''))
  20. for i in range(t):
  21. n = int(input(''))
  22. print(results[n-1])
  23.  
Success #stdin #stdout 0.18s 5936KB
stdin
3
3
10
100
stdout
6
31
2920