Under construction

Still being built. Things may change

optimizing

Time limit2sMemory limit1024 MB

Summary
Given n below 2^63, return the digit at index n (0-indexed) of the string formed by concatenating g(0), g(1), g(2), ... where g(k) is the sum of cubes below k.
Level

Medium6 of 10

Topics
Math, Binary search, Implementation
Solved
No attempts yet

Statement

Write a function optimizing.

The input parameter is an int object n satisfying 0≤0\le n <263<2^{63}. The return value is the int object f(n)f(n), where ff is the following Python function:

def f(n):
    assert type(n)==int and n>=0
    g=lambda n:sum([x**3 for x in range(n)])
    x=""
    k=0
    while n>=len(x):
        x+=str(g(k))
        k+=1
    return int(x[n])

Examples1

  1. Example 1

    Input
    1
    
    Expected output
    0