{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003eFor any positive integer n, n can be represented as sum of other positive cube numbers (n \u003d a\u003csub\u003e1\u003c/sub\u003e\u003csup\u003e3\u003c/sup\u003e + a\u003csub\u003e2\u003c/sub\u003e\u003csup\u003e3\u003c/sup\u003e + ... + a\u003csub\u003em\u003c/sub\u003e\u003csup\u003e3\u003c/sup\u003e). \r\nYour task is to print the smallest m, where m is number of cube numbers used to form n, such that n \u003d a\u003csub\u003e1\u003c/sub\u003e\u003csup\u003e3\u003c/sup\u003e + a\u003csub\u003e2\u003c/sub\u003e\u003csup\u003e3\u003c/sup\u003e + ... + a\u003csub\u003em\u003c/sub\u003e\u003csup\u003e3\u003c/sup\u003e.\r\nFor example: \r\n\u003c/p\u003e\u003cul\u003e\r\n\u003cli\u003en \u003d 5, n \u003d 1\u003csup\u003e3\u003c/sup\u003e + 1\u003csup\u003e3\u003c/sup\u003e + 1\u003csup\u003e3\u003c/sup\u003e + 1\u003csup\u003e3\u003c/sup\u003e + 1\u003csup\u003e3\u003c/sup\u003e (m \u003d 5)\u003c/li\u003e\r\n\u003cli\u003en \u003d 8, n \u003d 2\u003csup\u003e3\u003c/sup\u003e (m \u003d 1)\u003c/li\u003e\r\n\u003cli\u003en \u003d 35, n \u003d 2\u003csup\u003e3\u003c/sup\u003e + 3\u003csup\u003e3\u003c/sup\u003e (m \u003d 2)\u003c/li\u003e\r\n\u003c/ul\u003e\u003cp\u003e\u003c/p\u003e\r\n\u003cb\u003eNote: My fastest time is 0.09s :). \u003cbr\u003eEdit: My fastest time is 0.05s now lol\u003cbr\u003e My Java solution is also accepted.\u003c/b\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eInput consists of several test cases separated by new lines. Each test case consists of a positive integer, denoting the number of n (1 ≤ n ≤ 10\u003csup\u003e5\u003c/sup\u003e). Input is terminated by end of file (EOF).\u003cbr\u003e It is guaranteed that total test case per input file is less than 10\u003csup\u003e5\u003c/sup\u003e.\r\n\u003cbr\u003e\u003cbr\u003e \u003cb\u003e Note: For c++ users, you can use \twhile(scanf(\"%d\",\u0026amp;n)!\u003dEOF); to read input until EOF.\u003cbr\u003eWarning: large Input/Output data, be careful with certain languages!.\u003c/b\u003e\r\n\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each case, print \"Case #X: M\", where X (1 ≤ X ≤ 10\u003csup\u003e5\u003c/sup\u003e) is the case number, and M is the minimum cube numbers used to form the integer n. There must be no trailing spaces at the end of printed lines, neither empty characters. Print a newline after each testcase. \r\n\r\n\u003c/p\u003e\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n2\r\n5\r\n8\r\n35\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 1\r\nCase #2: 2\r\nCase #3: 5\r\nCase #4: 1\r\nCase #5: 2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\r\n\n\u003c/div\u003e"}}]}