problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p03329 | u131406572 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['s=[1]\nn=int(input())\nfor i in range(1,7):\n s.append(6**i)\nfor i in range(1,6):\n s.append(9**i)\ns.sort(reverse=True)\nprint(s)\nc=0;i=0\nwhile n>0:\n if n<s[i]:\n i+=1\n else:\n n-=s[i]\n c+=1\nprint(c)\n', 'a=[1,6,36,216,1296,7776,46656,9,81,729,6561,59049]\nn=int(input())\ndp=[... | ['Wrong Answer', 'Accepted'] | ['s639532744', 's622090606'] | [3064.0, 3828.0] | [17.0, 371.0] | [250, 248] |
p03329 | u134789640 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["import sys\nimport numpy as np\n\n\nN = int(input())\n\ndp = np.zeros(N,dtype=np.int)\ndp[0] = 1\n\nsix_count = 1\nnine_count = 1\n\nfor i in range(1,N):\n a = dp[i-1] + 1\n\n if i == pow(6,six_count):\n six_count = six_count + 1\n if i == pow(9,nine_count):\n nine_count = nine_count + 1\n\n ... | ['Wrong Answer', 'Accepted'] | ['s278253996', 's986864896'] | [14792.0, 15032.0] | [2109.0, 769.0] | [555, 316] |
p03329 | u139115460 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["num = int(input())\nres = num\nfor i in range(num):\n cc = 0\n t = i\n while(t > 0):\n cc += t%6\n t //=6\n t = num-i\n while(t > 0):\n cc += t%9\n t //=9\n if res > cc:\n print('res:',res)\n print('cc:',cc)\n res = cc\n\nprint(res)\n", "num = int(inp... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s091859916', 's569421314', 's229092581'] | [3060.0, 3060.0, 3060.0] | [335.0, 305.0, 286.0] | [283, 283, 235] |
p03329 | u160244242 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\n\ndp = [0]*100001\nfor i in range(1, n+1):\n candi = []\n for j in lst:\n if i >= j:\n candi.append(dp[i-j]+1)\n dp[i] = min(candi)\nprint(dp[i])', 'n = int(input())\n\nlst = []\nfor i in range(7):\n lst.append(6**i)\nfor i in range(1, 6):\n lst.append(9**i)\n\ndp = ... | ['Runtime Error', 'Accepted'] | ['s591950568', 's983905248'] | [3828.0, 3828.0] | [18.0, 340.0] | [181, 274] |
p03329 | u163320134 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\nans=10**10\ndp=[0]*100001\nfor i in range(1,n+1):\n tmp=[dp[i]+1]\n if i>=6**1:\n tmp.append(dp[i-6**1]+1)\n if i>=9**1:\n tmp.append(dp[i-9**1]+1)\n if i>=6**2:\n tmp.append(dp[i-6**2]+1)\n if i>=9**2:\n tmp.append(dp[i-9**2]+1)\n if i>=6**3:\n tmp.append(dp[i-6**3]+1)\n if i>=9... | ['Wrong Answer', 'Accepted'] | ['s024658885', 's126759997'] | [3956.0, 3956.0] | [298.0, 285.0] | [624, 626] |
p03329 | u168489836 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['cnt = 0\nn = int(input())\nres = n - n%9\ncnt += int(res/9)\nres = res - res%6\ncnt += int(res/6)\ncnt += res\nprint(cnt)', 'N=int(input())\nans=N\nfor i in range(N+1):\n cnt=0\n t=i\n while t>0:\n cnt+=t%6\n t//=6\n j=N-i\n while j>0:\n cnt+=j%9\n j//=9\n ans = min(ans,c... | ['Wrong Answer', 'Accepted'] | ['s975551126', 's303763491'] | [3060.0, 3060.0] | [17.0, 329.0] | [114, 195] |
p03329 | u173329233 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nlist = []\nfor i in [6,5,4,3,2,1]:\n\n for r in [9,6,]:\n while n > r**i:\n n = n - r**i\n list.append(r**i)\n print(n)\n\n\nlength = len(list) + n\nprint(length)\n', 'n = int(input())\nres = n\nans = 0\nfor i in range(n+1):\n t = i\n cc = 0\n whil... | ['Wrong Answer', 'Accepted'] | ['s183105981', 's780621800'] | [2940.0, 3064.0] | [17.0, 270.0] | [212, 255] |
p03329 | u180058306 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['from math import log\n\nN = int(input())\n\n\ndef func(N, a):\n index = int(log(N) / log(a))\n return a ** index\n\n\ndef search_times_re(N):\n times = 0\n if N < 6:\n times = N\n return times\n elif N < 9:\n times = 1 + (N - 6)\n else:\n N1 = search_times_re(N - func(N, ... | ['Runtime Error', 'Accepted'] | ['s663478185', 's030477914'] | [3064.0, 3060.0] | [19.0, 65.0] | [661, 222] |
p03329 | u192908410 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['def times(money, mod):\n ans = 0\n x = 1\n while( x * mod < money):\n x *= mod\n while(money > mod):\n ans += money // x\n money = money % x\n x = x // mod\n return(ans + money)\n\na = []\nb = []\nfor i in range(100001):\n a.append(times(i,6))\n b.append(times(i,9))\n\nc = []\nn = int(input())\nfor... | ['Wrong Answer', 'Accepted'] | ['s266220424', 's970412660'] | [5508.0, 3864.0] | [408.0, 217.0] | [352, 211] |
p03329 | u201234972 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['from bisect import bisect_right\nN = int(input())\nc = 0\nroku = [6**i for i in range(1,7)]\nkyu = [9**i for i in range(1,6)]\nable = sorted([0,1] + roku + kyu)\nprint(able)\nwhile N != 0:\n N = N - able[bisect_right(able,N)-1]\n c += 1\nprint(c)', 'from bisect import bisect_right\nN = int(input())\nc = 0\ndef ... | ['Wrong Answer', 'Accepted'] | ['s567394346', 's802898799'] | [3188.0, 3064.0] | [19.0, 1388.0] | [242, 452] |
p03329 | u202570162 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["n = int(input())\nc = [1]\nfor i in [6,9]:\n j = 0\n k = 0\n while True:\n j += 1\n k = i**j\n if k > 10**5:\n break\n c += [k]\nprint(c)\nc.sort(reverse=True)\nflag = 0\nfor i in range(len(c)):\n m = int(n//c[i])\n n %= c[i]\n flag += m\n # print('withdraw'... | ['Wrong Answer', 'Accepted'] | ['s754683287', 's060310416'] | [3064.0, 3864.0] | [17.0, 650.0] | [345, 516] |
p03329 | u218843509 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\n\nans = 0\n\nmod_list = [59409, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6]\n\nfor i in mod_list:\n\tprint(n // i)\n\tans += n // i\n\tn = n % i\n\nprint(ans + n)', 'n = int(input())\n\nans = 0\nmod_base = [59049, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6, 1]\nmod_list = [59049, 46656, 77... | ['Wrong Answer', 'Accepted'] | ['s459165038', 's302761263'] | [3060.0, 5472.0] | [17.0, 308.0] | [171, 554] |
p03329 | u220843654 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["# -*- coding: utf-8 -*-\n\nimport os\nimport sys\n\ndef main():\n n = int(input())\n l1 = lis(n, 9)\n l2 = lis(n, 6)\n print(l1)\n print(l2)\n l1.extend(l2)\n l1 = list(set(l1))\n l1.sort(key=int, reverse=True)\n print(minus(n, l1))\n\ndef lis(n, i):\n count = 0\n res = []\n oi = i... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s168679484', 's449118948', 's969117266', 's948259204'] | [3064.0, 3064.0, 5012.0, 3992.0] | [18.0, 19.0, 328.0, 317.0] | [696, 648, 743, 729] |
p03329 | u227082700 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\na=n\nfor i in range(n+1):\n ni,si=i,n-i\n m=0\n while ni!=0:m+=ni%6;ni//=6\n while si!=0:m+=si%6;si//=6\n a=min(a,m)\nprint(a)', 'n=int(input())\na=n\nfor i in range(n+1):\n ni,si=i,n-i\n m=0\n while ni!=0:m+=ni%9;ni//=9\n while si!=0:m+=si%6;si//=6\n a=min(a,m)\nprint(a)\n'] | ['Wrong Answer', 'Accepted'] | ['s854512336', 's178998150'] | [2940.0, 2940.0] | [377.0, 329.0] | [139, 140] |
p03329 | u239528020 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['#!/usr/bin/env python3\n# import math\nn = int(input())\n\nans = [-1]*(n+1)\n\nans[0] = 0\nfor i in range(1, n):\n num = i\n data = ans[i-1]+1\n for j in range(8):\n index = i-6**j\n if index < 0:\n break\n data = min(data, ans[index]+1)\n for j in range(8):\n index ... | ['Wrong Answer', 'Accepted'] | ['s028311181', 's552725439'] | [10372.0, 9656.0] | [652.0, 670.0] | [419, 425] |
p03329 | u243572357 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nlst_take = []\nmax_val = 100000\nused = []\nfor i in range(1,15):\n if 6 ** i <= max_val:\n lst_take.append(6**i)\n if 9 ** i <= max_val:\n lst_take.append(9**i) \nlst_take = sorted(set(lst_take), reverse=True)\nwhile True:\n if n==0:\n break\n \n flag = True\n for i in lst_take:\... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s056010374', 's065796981', 's357310751', 's407199543', 's577508274'] | [9020.0, 3060.0, 3064.0, 3060.0, 9192.0] | [22.0, 17.0, 17.0, 170.0, 213.0] | [466, 264, 328, 283, 195] |
p03329 | u244416763 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\ndp = [100000000000 for _ in range(n+1)]\ndp[0] = 0\nfor i in range(n):\n dp[i+1] = min(dp[i]+1,dp[i+1])\n six = 0\n nine = 0\n while (6**six < i):\n dp[i+1] = min(dp[(i+1) - 6**six] + 1,dp[i+1])\n six += 1\n while (9**nine < i):\n dp[i+1] = min(dp[(i+1) - 9**nine]... | ['Wrong Answer', 'Accepted'] | ['s340732872', 's121980298'] | [3864.0, 3864.0] | [1230.0, 1138.0] | [352, 339] |
p03329 | u246820565 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['dpの基本形\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nn = int(input())\npre_list = [1,6,9,36,81,216,729,1296,6561,7776,46656,59049]\n\n\ndp = [n]*(n+1)\n\ndp[0] = 0\n\n\n\nfor i in range(1,n+1):\n\n\tfor j in pre_list:\n\t\tif i - j >= 0:\n\t\t\tdp[i] = min(dp[i],dp[i-j]+1)\n\nprint(dp[n])\n', '\nn = int(input())\npre_list = [1,6,9,36... | ['Runtime Error', 'Accepted'] | ['s836800970', 's158337116'] | [3064.0, 3828.0] | [18.0, 539.0] | [1084, 429] |
p03329 | u254871849 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['\n# created: 2019-11-08 02:12:52(JST)\n## internal modules\nimport sys\n# import collections\nimport math\n# import string\n\n# import re\n# import itertools\n# import statistics\n# import functools\n\n## external modules\n# import scipy.special # if use comb function on AtCoder, \n# import ... | ['Wrong Answer', 'Accepted'] | ['s492162001', 's099155998'] | [3064.0, 3060.0] | [18.0, 210.0] | [915, 317] |
p03329 | u255067135 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import math\ndef dfs(cost, N):\n if N<6 :\n return cost+N\n else:\n ret0 = 6 ** math.floor(math.log(N, 6))\n ret1 = 9 ** math.floor(math.log(N, 9))\n return min(dfs(cost+1, N-ret0), dfs(cost+1, N-ret1))\n\nN = int(input())', 'def dfs(cost, N):\n if N<6 :\n return cost+N\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s090633797', 's906464073', 's509030582'] | [3060.0, 3064.0, 15088.0] | [18.0, 18.0, 617.0] | [247, 376, 370] |
p03329 | u256833330 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\nnl=[9**i for i in range(1,6)]\nsl=[6**i for i in range(1,7)]\nl = sorted(nl+sl)[::-1]\nx=0\nfor i in l:\n while True:\n if i <=n:\n n=n-i\n x+=1\n print(n)\n else:\n break\nprint(x+n)\n', 'n=int(input())\nnl=[9**i for i in range(1,6)]\nsl=[6... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s168448892', 's857731718', 's440066279'] | [3060.0, 3060.0, 3064.0] | [19.0, 18.0, 440.0] | [248, 257, 380] |
p03329 | u261082314 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['L=[1]\nn=int(input())\nx = 6\ny = 9\nwhile x <= n:\n L.append(x)\n x *= 6\nwhile y <= n:\n L.append(y)\n y *= 9\nL.sort()#[1,6,9,36,81]\ndp = [float("Inf")]*(n+1)\ndp[0] = 0\nfor i in range(n+1):#0~81\n for j in L:#1,6,9\n dp[i+j] = min(dp[i+j],dp[i]+1)#dp=[0,1,...1,.1]\nprint(dp[n])', 'L=[1]\nn=int(input())\... | ['Runtime Error', 'Accepted'] | ['s330909392', 's194617935'] | [9524.0, 9588.0] | [194.0, 475.0] | [276, 317] |
p03329 | u267325300 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\n\n\ndef get_rest(base, target):\n i = 0\n while base**i < target:\n i += 1\n return target - base**(i - 1)\n\n\ndef greedy(base, target):\n count = 0\n rest = target\n while rest >= base:\n rest = get_rest(base, rest)\n count += 1\n return count + rest\n\n\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s060319712', 's322827734', 's463458843'] | [3060.0, 2940.0, 3064.0] | [2104.0, 2104.0, 417.0] | [405, 383, 403] |
p03329 | u271934630 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nans = N\nfor i in range(N+1):\n cnt = 0\n while i > 0:\n cnt += i % 6\n i //= 6\n j = N-i\n while j > 0:\n cnt += j % 9\n j //= 9\n ans = min(ans, cnt)\nprint(ans)\n', 'n = int(input())\n\nans = n\nfor i in range(n+1):\n count = 0\n t = i\n while(t... | ['Wrong Answer', 'Accepted'] | ['s033806800', 's795534495'] | [2940.0, 3060.0] | [342.0, 457.0] | [213, 236] |
p03329 | u276468459 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nwd = []\nfor i in range(1, 7):\n wd.append(6**i)\nfor i in range(1, 6):\n wd.append(9**i)\nwd.append(1)\n\ndp = [N]*(N+1)\ndp[0] = 0\n\nfor i in range(len(wd)):\n for j in range(i, N+1):\n dp[j] = min(dp[j], dp[j-i]+1)\n\nprint(dp[N])', 'N = int(input())\nwd = []\nfor i in range(1, 7... | ['Wrong Answer', 'Accepted'] | ['s657924061', 's295672364'] | [6900.0, 4276.0] | [525.0, 434.0] | [253, 241] |
p03329 | u278430856 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\ncount = 0\nitr = 1\n\nwhile(N >= 9 or N >= 6):\n itr = 1\n flag = 0\n itr2 = 0\n while(N >= 9**itr or N >= 6**itr):\n itr += 1\n if N < 9**itr and flag == 0:\n itr2 = itr-1\n flag = 1\n if flag == 1:\n if 9**itr2 > 6**(itr-1):\n N ... | ['Wrong Answer', 'Accepted'] | ['s896999173', 's963926278'] | [3064.0, 3060.0] | [18.0, 18.0] | [707, 374] |
p03329 | u314089899 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import copy\nimport itertools\n\nN = int(input())\nsix_nines = set()\n\n\nfor i in range(1,6):\n a = 6**i\n if a <= N and a not in six_nines:\n six_nines.add(a)\n for j in range(1,N//a):\n six_nines.add(a*j)\n a = 9**i\n if a <= N and a not in six_nines:\n six_nines.add(a)\n for j in range(1,N//a... | ['Runtime Error', 'Accepted'] | ['s815662250', 's811006829'] | [3064.0, 51040.0] | [18.0, 360.0] | [1007, 1092] |
p03329 | u325282913 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nbank = [59049, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6, 1]\nans = 0\nwhile N != 0:\n for i in bank:\n if 6 <= N <= 14:\n N -= 6\n ans += 1\n # print(6,N)\n break\n if i <= N:\n N -= i\n ans += 1\n #... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s194981844', 's268756259', 's054429657'] | [3060.0, 3060.0, 89716.0] | [17.0, 17.0, 625.0] | [345, 235, 381] |
p03329 | u327532412 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nimport sys\nsys.setrecursionlimit(100000)\ndp = [-1] * (N + 1)\ndef rec(n):\n if n == 0:\n return 0\n if dp[n] != -1:\n return dp[n]\n res = n\n i = 0\n while n >= i ** 6:\n pow6 = i ** 6\n res = min(res, rec(n - pow6) + 1)\n i += 1\n\n j = 0\n ... | ['Runtime Error', 'Accepted'] | ['s116526085', 's718347754'] | [97492.0, 89716.0] | [292.0, 1193.0] | [447, 443] |
p03329 | u329407311 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\ndone = []\n\narr = [N]\nans = 0\nstop = 0\n \n\nwhile arr:\n\n a = arr.pop(0)\n\n done.append(a)\n\n Next = []\n if a-1 >= 0:\n Next.append(a-1)\n if a-6 >= 0:\n Next.append(a-6)\n if a-36 >= 0:\n Next.append(a-36)\n if a-216 >= 0:\n Next.append(a-216)\n if a-1296 >= 0:\n Ne... | ['Wrong Answer', 'Accepted'] | ['s662237121', 's085026494'] | [3316.0, 27032.0] | [2104.0, 541.0] | [1184, 581] |
p03329 | u329865314 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nsixs = [6,36,216,1296,7776,46656]\nnines = [9,81,729,6561,59049]\nlis = [0] + [100000 for i in range(170000)]\nfor i in range(0,100001):\n for j in sixs:\n if lis[i+j] > lis[i]+1:\n lis[i+j] = lis[i] + 1\n for j in nines:\n if lis[i+j] > lis[i]+1:\n lis[i+j] = lis[i] + 1\nprint(lis[n])', 'n ... | ['Wrong Answer', 'Accepted'] | ['s643457251', 's788529124'] | [5784.0, 9752.0] | [306.0, 297.0] | [301, 290] |
p03329 | u335295553 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\n\ndef hikidashi(n):\n if 35 >= n:\n tmp1 = n//9 + (n%9)//6 + (n%9)%6\n tmp2 = n//6 + n%6\n\n if tmp1 == tmp2:\n if n >= 9:\n return 9\n elif n >= 6:\n return 6\n else:\n return 1\n elif tmp1 ... | ['Wrong Answer', 'Accepted'] | ['s958095959', 's665278540'] | [3064.0, 3060.0] | [18.0, 358.0] | [980, 280] |
p03329 | u344813796 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['dp=[0 for i in range(100010)]\ndp[0]=0\nfor n in range(1,100001):\n dp[n]=200000\n power=1\n while(power<=n):\n dp[n]=min(dp[n],dp[n-power]+1)\n power*=6\n while(power<=n):\n dp[n]=min(dp[n],dp[n-power]+1)\n power*=9\n\nn=int(input())\nprint(dp[n])', 'dp=[1000000 for i in range(100010)]\ndp[0]=0\nfor ... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s341238211', 's445725900', 's960156533', 's211477499'] | [3956.0, 3956.0, 3956.0, 3956.0] | [409.0, 22.0, 426.0, 720.0] | [251, 248, 249, 252] |
p03329 | u354638986 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["nine, six = [9 ** i for i in range(1, 6)], [6 ** i for i in range(1, 7)]\n\n\ndef minimize(n, a_idx, b_idx, t):\n if n == 0:\n return t\n elif a_idx == -1 and b_idx == -1:\n return t + n\n\n t1, t2 = 100000, 100000\n if a_idx != -1:\n p = n // nine[a_idx]\n t1 = minimize(n-p*ni... | ['Wrong Answer', 'Accepted'] | ['s640516241', 's003364738'] | [3064.0, 3060.0] | [18.0, 202.0] | [726, 382] |
p03329 | u367130284 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import itertools as i\nn=int(input())\ncount=[]\ndef f(x):\n if x==0:\n return count\n b=list(i.takewhile(lambda i:9**i<=x,(i for i in range(100))))[-1]\n c=list(i.takewhile(lambda i:6**i<=x,(i for i in range(100))))[-1]\n if 9**b>6**c:\n count.append(b)\n return f(x-9**b)\n else:\... | ['Wrong Answer', 'Accepted'] | ['s966499054', 's201374959'] | [3064.0, 4348.0] | [20.0, 324.0] | [368, 321] |
p03329 | u374103100 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["N = int(input())\n\nM = 100000\n\nc = [59049, 46656, 7776, 6561, 1296, 729, 216, 81, 36, 9, 6, 1]\n\n\n# val = 9 ** i\n# if val <= M:\n# print(val)\n# c.append(val)\n#\n\n# val = 6 ** i\n# if val <= M:\n# print(val)\n# c.append(val)\n\ncount = 0\nrest = N\n\nfor i in c:... | ['Wrong Answer', 'Accepted'] | ['s194376175', 's554025321'] | [3064.0, 7064.0] | [19.0, 428.0] | [541, 447] |
p03329 | u375616706 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import math\nn = (int)(input())\n\nans = n\nl = (int)(math.log(n, 9)+1)\n\nfor i in range(n+1):\n tmp_ans = 0\n a_six = i\n a_nine = n-i\n for i in reversed(range(-1, 6)):\n tmp = a_six//6**i\n tmp_ans += tmp\n a_six -= tmp*6**i\n a_nine += a_six\n for i in reversed(range(-1, 5)):\n tmp = a_nine//9*... | ['Wrong Answer', 'Accepted'] | ['s789076241', 's922482641'] | [3188.0, 3064.0] | [1316.0, 1174.0] | [397, 389] |
p03329 | u422104747 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import zlib\nsol=b"x\\x9c\\xed\\x9dm\\x8f\\xe36\\x0c\\x84\\x7fk\\xaf\\xed%\\x96\\xb7\\xbd\\xeb\\xff\\xffR\\xc1\\xc1\\x12\\x01\\xb8\\x1e\\xd8c.3\\x8a\\x08\\x18\\x0b\\xc3\\xd4\\x0bE=\\x19\\xcbT6\\xfe\\xe3\\xc7\\x9f\\x7f\\xfd\\xfd\\xb3\\xff\\xe9G?{\\x1c\\xfd\\xca\\xe3\\xf8\\xfb\\xe7\\xad\\x1f[\\x91\\xdb\\x97\\xa6~\\xfc\... | ['Runtime Error', 'Accepted'] | ['s221221156', 's740805379'] | [3060.0, 3956.0] | [17.0, 524.0] | [9340, 206] |
p03329 | u427984570 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['a = int(input())\nl1 = [6**i for i in range(7)]\nl2 = [9**i for i in range(7)]\nl = sorted(l1 + l2)\nl.pop(0)\nl.pop(-1)\ncnt = 0\nprint(l)\nwhile a != 0:\n print(a)\n for i in range(len(l)):\n if a - l[i] < 0:\n a -= l[i-1]\n cnt += 1\n break\n \nprint(cnt)', 'a = int(input())\nl = [6**i for i... | ['Wrong Answer', 'Accepted'] | ['s635307391', 's498615096'] | [8764.0, 3864.0] | [2104.0, 596.0] | [265, 307] |
p03329 | u428397309 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['# -*- coding: utf-8 -*-\n\nN = int(input())\n\nans = N\nfor i in range(N // 9 + 1):\n nine = i * 9\n six = N - nine\n tmp_ans = 0\n print(nine, six)\n while nine > 0:\n tmp_ans += nine % 9\n nine = nine // 9\n while six > 0:\n tmp_ans += six % 6\n six = six // 6\n ans ... | ['Wrong Answer', 'Accepted'] | ['s956372400', 's811630760'] | [3460.0, 3060.0] | [63.0, 53.0] | [334, 313] |
p03329 | u440161695 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['A=[1,6,36,216,1296,7776,46656,9,81,729,6561,59049]\nN=int(input())\nans=0\nwhile N!=0:\n N-=max([a for _ in A if A<=N])\n ans+=1\nprint(ans)', 'N=int(input())\ndp=[float("INF")]*(N+2)\ndp[0]=0\na,b,c=1,1,0\nfor i in range(1,N+1):\n if i==6*a:\n a*=6\n if i==9*b:\n b*=9\n dp[i]=min(dp[i],dp[i-1],dp[i-a],dp[... | ['Runtime Error', 'Accepted'] | ['s549770051', 's099215479'] | [3060.0, 3828.0] | [18.0, 98.0] | [136, 241] |
p03329 | u440904221 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\n\ndef search(n,num):\n i = 1\n while True:\n if n < num**i:\n return i-1\n i += 1\n \nans = n\nfor i1 in range(0,6):\n for i2 in range(0,6):\n for i3 in range(0,6):\n for i4 in range(0,6):\n for i5 in range(0,6):\n ... | ['Wrong Answer', 'Accepted'] | ['s217540598', 's015754265'] | [3064.0, 3064.0] | [130.0, 200.0] | [896, 932] |
p03329 | u455104068 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['def tans(N, sei):\n import math\n sin = int(math.log(N,9))\n cos = int(math.log(N,6))\n count = sei\n if ((sin != 0) and (cos != 0)):\n if N < 15:\n if N >= 12:\n count += 2\n b2 = N - 12\n return tans(b2, count)\n elif (math.pow(9, sin) > math.pow(6,cos)):\n c = int(N - math... | ['Runtime Error', 'Accepted'] | ['s999280574', 's758731503'] | [3188.0, 3064.0] | [18.0, 18.0] | [535, 530] |
p03329 | u482680085 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\ncount = 0\nans = []\nfor i in range(N+1):\n count1 = 0\n count2 = 0\n N1 = N - i\n x = i\n while x:\n count1 += x % 6\n x //= 6\n while N1\n count2 += x % 9\n N1 //= 9\n count = count1 + count2\n ans.append(count)\nprint(min(ans))\n', 'N = int(inpu... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s328161585', 's450287908', 's149084091'] | [2940.0, 2940.0, 3864.0] | [17.0, 17.0, 308.0] | [285, 286, 287] |
p03329 | u503228842 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nnums = [1]\ndef under_nums(N,m):\n nums = []\n i = 1\n while m**i <= N:\n nums.append(m**i)\n i += 1\n return nums\nall_nums = nums+under_nums(N,6)+under_nums(N,9)\nall_nums.sort(reverse=True)\nprint(all_nums)\ncnt = 0\nidx = 0\nmoney = N\na = []\nwhile money > 0:\n whil... | ['Wrong Answer', 'Accepted'] | ['s208321349', 's422834985'] | [3064.0, 92020.0] | [18.0, 650.0] | [524, 402] |
p03329 | u513081876 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nans = 0\na = [9**i for i in range(1, 6)]\nb = [6**i for i in range(1, 7)]\nab = a+b\nab.sort(reverse=True)\nwhile N >= 6:\n for i in ab:\n if N >= i:\n N = N - i\n ans += 1\n break\nprint(ans+N)\nprint(ans)\nprint(N)', 'N = int(input())\n\ndp = [int(i) for ... | ['Wrong Answer', 'Accepted'] | ['s720349283', 's033848414'] | [3060.0, 7064.0] | [17.0, 522.0] | [263, 274] |
p03329 | u514383727 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nws = [1]\nws += [6**i for i in range(1, 8)]\nws += [9**i for i in range(1, 6)]\nws = sorted(set(ws))\n\nprint(ws)\nINF = 10**5\ndp = [INF] * (n+1)\ndp[0] = 0\nfor i in range(n+1):\n for w in ws:\n if i + w <= n:\n dp[i+w] = min(dp[i]+1, dp[i+w])\nprint(dp[-1])', 'n = int(input()... | ['Wrong Answer', 'Accepted'] | ['s482811196', 's695076310'] | [3828.0, 3956.0] | [724.0, 625.0] | [285, 276] |
p03329 | u518042385 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\nnum6=6\nnum9=9\nwhile num6<=n:\n l.append(num6)\n num6*=6\nwhile num9<=n:\n l.append(num9)\n num9*=9\ncount=[0,1,2,3,4,5,1,2,3,1,2,3]\nfor i in range(12,n+1):\n min=100000\n for j in l:\n if i-j<0:\n pass\n else:\n if min>count[i-j]+1:\n min=count[i-j]+1\n count.append(mi... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s404370361', 's517244434', 's855699272'] | [3064.0, 3060.0, 3876.0] | [17.0, 17.0, 296.0] | [318, 229, 324] |
p03329 | u528005130 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['# coding: utf-8\n# Your code here!\nimport math\nfrom collections import defaultdict\n \nN = int(input())\n \nmemo = defaultdict(lambda: -1)\nmemo[0] = 0\ndef recursive(n):\n if memo[n] != -1:\n return memo[n]\n \n min_num_operation = n\n \n index = 0\n temp_n = n\n while temp_n > 0:\n ... | ['Wrong Answer', 'Accepted'] | ['s267875598', 's433785099'] | [4020.0, 3316.0] | [32.0, 22.0] | [892, 986] |
p03329 | u539517139 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\nk=[59049,46646,7776,6561,1296,729,216,81,36,9,6]\nc=0\nwhile n>6:\n for i in k:\n if n-i>0:\n n=n-i\n c+1\nc+=n\nprint(n)', 'n=int(input())\nb=[1,6,36,216,1296,7776,46656]\nq=[9,81,729,6561,59049]\nd=[100000]*(n+1)\nd[0]=0\nfor i in range(n):\n for j in b:\n if i+j<=n:\n d[i+j]=... | ['Wrong Answer', 'Accepted'] | ['s969744802', 's289815830'] | [2940.0, 3828.0] | [17.0, 658.0] | [142, 246] |
p03329 | u540761833 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\ndp = [[float(\'inf\') for i in range(N+1)] for j in range(3)]\ndp[0][0] = 0\ndp[2][0]= 0\ndef below_power(n,a):\n "n以下になるa**xのxの最大値を求める"\n x = 0\n while n >= a**x:\n x += 1\n return x-1\nnine = below_power(N,9)\nsix = below_power(N,6)\nfor i in range(nine,0,-1):\n dp[1][9**i] =... | ['Wrong Answer', 'Accepted'] | ['s844992951', 's425796871'] | [17152.0, 6296.0] | [986.0, 1154.0] | [741, 556] |
p03329 | u543954314 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nans = n\nl9 = [9**i for i in range(6,0,-1)]\nl6 = [6**i for i in range(7,-1,-1)]\nfor i in range(n//9+1):\n x9 = i*9\n x61= n-x9\n csum = 0\n for x in l9:\n csum += x9//x\n x9 %= x\n for x in x61:\n csum += x61//x\n x61 %= x\n if ans > csum:\n ans = csum\nprint(ans) ', 'n = i... | ['Runtime Error', 'Accepted'] | ['s671455003', 's977276797'] | [3064.0, 3064.0] | [18.0, 57.0] | [293, 288] |
p03329 | u545368057 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nxs = [1]\ni = 1\nwhile N > 6**i:\n if 9**i < N:\n xs.append(9**i)\n xs.append(6**i)\n i += 1\nX = sorted(xs)\nprint(X)\n\n\ndp = [10000000000] * 1008000\ndp[1] = 1\nfor i in range(N):\n for x in X:\n dp[i+x] = min(dp[i]+1, dp[i+x])\nprint(dp[N])', 'N = int(input())\nn6 = 1\... | ['Wrong Answer', 'Accepted'] | ['s009067666', 's727963758'] | [10868.0, 54436.0] | [569.0, 621.0] | [302, 411] |
p03329 | u548303713 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import sys\nsys.setrecursionlimit(10**9)\n\nn=int(input())\nmaxn=110000\nmemo=[-1 for i in range(maxn)]\ndef rec(n):\n if n==0:\n return 0\n if memo[n]!=-1:\n return memo[n]\n res=n\n i=1\n while i<=n:\n res=min(res,rec(n-i)+1)\n i*=6\n j=1\n while i<=n:\n res=m... | ['Wrong Answer', 'Accepted'] | ['s341911969', 's170499313'] | [89880.0, 3992.0] | [481.0, 731.0] | [380, 348] |
p03329 | u559103167 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N=int(input())\nans=0\nfor i in range(N+1):\n cnt=0\n while i>0:\n cnt+=i%6\n i//=6\n j=N-i\n while j>0:\n cnt+=j%9\n j//=9\n ans=min(ans,cnt)\nprint(ans)', 'N=int(input())\nans=N\nfor i in range(N+1):\n cnt=0\n while i>0:\n cnt+=i%6\n i//=6\n j=N-i\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s240742655', 's254910405', 's458470811'] | [3060.0, 3060.0, 3060.0] | [404.0, 325.0, 352.0] | [185, 185, 203] |
p03329 | u576432509 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\n\nn9=9**5\nn6=6**6\n\nk9=5+1\nk6=6+1\nn9=9**k9\nsmin=n\nfor i9 in range(n9):\n ii9=i9\n s=0\n m=0\n astr=""\n for ii in range(1,k9+1):\n r9=ii9%9\n ii9=(ii9-r9)//9 \n s=s*9+r9\n m=m+r9\n astr=astr+str(r9)\n# print("i9",i9,"astr",astr,"s",s,"m",m)... | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s288554484', 's614738936', 's273605022'] | [3064.0, 3884.0, 3060.0] | [2107.0, 638.0, 276.0] | [646, 662, 208] |
p03329 | u585742242 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['# -*- coding: utf-8 -*-\nimport sys\nimport functools\nsys.setrecursionlimit(10**6)\n\n# N = int(input())\nMAXN = 10**5\nsix_ps = [6**i for i in range(1, 7)]\nnine_ps = [9**i for i in range(1, 6)]\n\n\n@functools.lru_cache(maxsize=None)\ndef rec(n):\n if n < 6:\n return n\n\n if n in six_ps or n in nine_... | ['Wrong Answer', 'Accepted'] | ['s201613548', 's691962494'] | [3828.0, 3828.0] | [275.0, 565.0] | [595, 366] |
p03329 | u591295155 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['INF = 10 ** 20\n\nW,N = map(int,input().split())\ncoin_list = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]\ndp = [INF]*(W+1)\ndp[0] = 0\n \nfor coin in coin_list:\n for i in range(coin,W+1):\n dp[i] = min(dp[i], dp[i-coin]+1)\n \nprint(dp[W])', 'INF = 10 ** 20\n\nN = int(input())\ncoin_li... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s255936540', 's371053891', 's069990399'] | [3064.0, 3064.0, 6900.0] | [17.0, 18.0, 458.0] | [260, 246, 246] |
p03329 | u597374218 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N=int(input())\nans=N\nfor i in range(N+1):\n j=N-i\n cnt=0\n while i>0:\n cnt+=i%6\n i//=6\n print(cnt,j)\n while j>0:\n cnt+=j%9\n j//=9\n print(i,cnt)\n ans=min(ans,cnt)\nprint(ans)', 'N=int(input())\nans=N\nfor i in range(N+1):\n count=0\n t=i\n while t>0:... | ['Wrong Answer', 'Accepted'] | ['s706161322', 's545510849'] | [4852.0, 9012.0] | [552.0, 214.0] | [219, 201] |
p03329 | u597455618 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nans = 0\na = [0] * 12\nfor i in range(1, 7):\n print(i)\n a[2*(i-1)] += max((9**(i-1)), (6**i))\n a[2*(i-1)-1] += min((9**(i-1)), (6**i))\nprint(a)\nfor i in a:\n if (n//i) != 0:\n ans += n//i\n n -= n//i * i\n\nprint(ans)', 'import bisect as bi\n\ndef ref(n):\n if n < 6:\n return n\n ... | ['Wrong Answer', 'Accepted'] | ['s179693523', 's208992833'] | [3188.0, 3064.0] | [19.0, 19.0] | [237, 263] |
p03329 | u600402037 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\ni=1\ncount=0\nn6=1\nn9=1\nl=[1]\nwhile True:\n if 9**i>n:\n n9=i-1\n break\n i+=1\ni=1\nwhile True:\n if 6**i>n:\n n6=i-1\n break\n i+=1\nfor i in range(n6):\n l.append(6**(i+1))\nfor i in range(n9):\n l.append(9**(i+1))\nl.sort(reverse=True)\nfor i in l:\... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s067282705', 's111845520', 's933249642'] | [3064.0, 2940.0, 3064.0] | [17.0, 313.0, 326.0] | [351, 185, 480] |
p03329 | u607075479 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nsix = [6**i for i in range(7)]\nnine = [9**i for i in range(6)]\nL = []\nfor s in six:\n L.append(s)\nfor s in nine[1:]:\n L.append(s)\nL.sort(reverse=True)\nans = 0\nfor l in L:\n while N > 0:\n ans += N // l\n N %= l\nprint(ans)', 'import sys\nimport math\nfrom collections import deque\n\... | ['Time Limit Exceeded', 'Accepted'] | ['s659214406', 's320422392'] | [9100.0, 9368.0] | [2205.0, 51.0] | [243, 639] |
p03329 | u611368136 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\nans = 0\n\nl = []\np = 0\nwhile True:\n power = pow(9, p)\n if power > n:\n break\n else:\n l.append(power)\n p += 1\np = 0\nwhile True:\n power = pow(6, p)\n if power > n:\n break\n else:\n l.append(power)\n p += 1\nl = list(set(l))\nl.sort()\nl.r... | ['Wrong Answer', 'Accepted'] | ['s808991307', 's705646093'] | [3064.0, 3860.0] | [17.0, 608.0] | [398, 308] |
p03329 | u614181788 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\ndp = [float("Inf")]*(n+1)\ndp[0] = 0\nfor i in range(n):\n if dp[i] == float("Inf"):\n pass\n else:\n for j in range(1,n//6):\n if i + 6**j > n:\n break\n dp[i+6**j] = min(dp[i+6**j], dp[i] + 1)\n for j in range(1,n//9):\n if... | ['Wrong Answer', 'Accepted'] | ['s012269145', 's635911655'] | [10608.0, 9592.0] | [383.0, 1003.0] | [487, 360] |
p03329 | u619458041 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["import sys\n\ndef f(n):\n X6 = []\n X9 = []\n for i in range(1, 10):\n if n >= 6**i:\n X6.append(6**i)\n if n >= 9**i:\n X9.append(9**i)\n return X6, X9\n\n\ndef main():\n input = sys.stdin.readline\n N = int(input())\n X6, X9 = f(N)\n X = [1] + X6 + X9\n dp = [0 for _ in range(N+1)]\n for i... | ['Wrong Answer', 'Accepted'] | ['s965291490', 's226185898'] | [3864.0, 3064.0] | [235.0, 20.0] | [449, 427] |
p03329 | u620846115 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\ndef f(x):\n ans=0\n while x >0:\n ans+=x%6\n x = x//6\n return ans\ndef g(x):\n ans=0\n while x >0:\n ans+=x%9\n x = x//9\n return ans\nans = n\nfor i in range(n+1):\n ans = min(ans,f(n-i),g(i))\nprint(ans)\n\n', 'n=int(input())\ndef f(x):\n ans=0\n while x>0:\n ans+=... | ['Wrong Answer', 'Accepted'] | ['s413608597', 's519927018'] | [8996.0, 9096.0] | [152.0, 152.0] | [229, 244] |
p03329 | u623687794 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\nw=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]\nans=0\nfor i in range(11,0,-1):\n ans+=(n//w[i])\n n-=ans*w[i]\nprint(ans)', 'n=int(input())\nINF=10**7\nw=[1,6,9,36,81,216,729,1296,6561,7776,46656,59049]\ndp=[INF]*100001\ndp[0]=0\nfor i in range(100001):\n for j in w:\n if i+j>100000:continu... | ['Wrong Answer', 'Accepted'] | ['s853267453', 's465180392'] | [3060.0, 3828.0] | [17.0, 708.0] | [138, 210] |
p03329 | u626337957 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\nINF = 10**6\ndp = [INF] * (N+1)\nfor i in range(9):\n if i < 6:\n dp[i] = i\n elif i < 9:\n dp[i] = i%6+1\n\nfor i in range(N):\n n = m = 1\n while i+9*n <= N:\n dp[i+9*n] = min(dp[i+9*n], dp[i] + 1)\n n += 1\n while i+6*m <= N:\n dp[i+6*m] = min(dp[i+6*m], dp[i] + 1)\n m += 1... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s209764170', 's362161180', 's389538286', 's468478083', 's773039416', 's997435537', 's401636670'] | [3828.0, 3064.0, 3828.0, 3064.0, 3828.0, 3828.0, 3828.0] | [2104.0, 17.0, 1593.0, 17.0, 47.0, 618.0, 1445.0] | [321, 422, 419, 443, 341, 333, 262] |
p03329 | u633548583 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n,k=map(int,input().split())\nh=list(map(int,input().split()))\ndp=[10**5]*n\ndp[0]=0\nfor i in range(n):\n pow=1\n while pow<=n:\n dp[i]=min(dp[i],dp[i-pow]+1)\n pow*=6\n pow=1\n while pow<=n:\n dp[i]=min(dp[i],dp[i-pow]+1)\n pow*=9\nprint(dp[n-1])', 'n=int(input())\ndp=[10**5... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s277667225', 's429801531', 's699477612', 's795115385', 's032147811'] | [3064.0, 3828.0, 3828.0, 3828.0, 3828.0] | [18.0, 683.0, 660.0, 780.0, 823.0] | [276, 230, 232, 230, 234] |
p03329 | u639592190 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N=int(input())\nans=0\nn=10\ns=10\nwhile N>=6:\n if N-max(6**s,9**n)>=0:\n N-=max(6**s,9**n)\n print(n,s,N)\n ans+=1\n else:\n bl=int(6**s<9**n)\n n-=bl\n s-=1-bl\n if n==0 and s==0:\n break\nprint(N)\nprint(ans+N)\n ', 'N=int(input())\nans=N\nfor i in range(N+1):\n cnt=0\n s=i\n w... | ['Wrong Answer', 'Accepted'] | ['s428362402', 's878293349'] | [3064.0, 3060.0] | [17.0, 348.0] | [227, 193] |
p03329 | u652656291 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\n\narr6 = []\nfor i in range(10):\n\tarr6.append(6**i)\n\narr9 = []\nfor i in range(10):\n\tarr9.append(9**i)\n\n\nans = float("inf")\nfor i in range(n+1):\n\tcount = 0\n\ttmp = i\n\twhile tmp > 0:\n\t\tt = 0\n\t\twhile arr6[t] <= tmp:\n\t\t\tt+=1\n\n\t\ttmp -= arr6[t-1]\n\t\tcount += 1\n\n\ttmp = n-... | ['Runtime Error', 'Accepted'] | ['s215247306', 's815555980'] | [3064.0, 13636.0] | [17.0, 188.0] | [404, 301] |
p03329 | u654386293 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['def solve():\n n = int(input())\n dp = [0 for _ in range(n+1)] \n\n for i in range(1, n+1):\n options = find_options(i)\n selected = min(map(lambda x: [x, dp[i - x]], options), key=lambda x: x[1])\n print(selected)\n dp[i] = dp[i-selected[0]] + 1\n\n print(dp[n])\n\ndef find_op... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s128859202', 's820014565', 's666832818'] | [4708.0, 3992.0, 3992.0] | [1010.0, 765.0, 776.0] | [997, 998, 954] |
p03329 | u667024514 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["n = int(input())\n\nlis = [1, 6, 36, 216, 1296, 7776, 46656,\n 9, 81, 729, 6561, 59049]\nm = len(c)\n\ndp = [float('inf') for _ in range(n+1)]\ndp[0] = 0\n\nfor j in range(1,n+1):\n temp = []\n for i in range(m):\n if j < c[i]:\n continue\n else:\n temp.append(dp[j-lis[i]... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s401214960', 's801142033', 's266903667'] | [3064.0, 3064.0, 3864.0] | [17.0, 17.0, 546.0] | [344, 346, 277] |
p03329 | u669173971 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n=int(input())\n\ndef solve():\n inf=10**7\n dp=[inf]*(n+1)\n dp[0]=0\n \n for i in range(1,n+1):\n power=1\n while power<=i:\n dp[i]=min(dp[i],dp[i-power]+1)\n power*=6\n #print(dp)\n\n \n for i in range(1,n+1):\n power2=1\n while power2<=i:\n... | ['Wrong Answer', 'Accepted'] | ['s728966260', 's643176409'] | [4848.0, 3828.0] | [390.0, 381.0] | [483, 469] |
p03329 | u677440371 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\ndp = [int(i) for i in range(10 ** 5 + 1)]\n\nfor i in [6,9]:\n v = i\n while v < 10 ** 5:\n for j in range(len(dp)):\n if j+v <= 10 ** 5:\n dp[j+v] =min(dp[j]+1,dp[j+v])\n v *= i \n \nprint(dp[10**5])', 'n = int(input())\n\nmax_range = 10 ** 5\nd... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s213589762', 's274957739', 's505949282', 's893136267'] | [7064.0, 2940.0, 7064.0, 7064.0] | [591.0, 17.0, 737.0, 687.0] | [261, 310, 260, 312] |
p03329 | u680851063 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['l_6 = []\n_ = 1\nwhile 6**_ < 100000:\n l_6.append(6**_)\n _ += 1\nl_6.sort(reverse = 1)\n\nl_9= []\n_ = 1\nwhile 9**_ < 100000:\n l_9.append(9**_)\n _ += 1\nl_9.sort(reverse = 1)\nprint(l_6, l_9)\n\nn = int(input())\n\nw = 0\nz = []\nfor i in range(n+1):\n x = i\n for j in range(len(l_6)):\n ... | ['Wrong Answer', 'Accepted'] | ['s077728597', 's941738018'] | [3992.0, 4596.0] | [982.0, 568.0] | [567, 288] |
p03329 | u681340020 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n_max = 100000\n\nbs = [(6 ** i, 6) for i in range (1, 10)]\nbs.extend([(9 ** i, 9) for i in range (1, 10)])\nbs = list(sorted(filter(lambda x: x[0] <= n_max, bs)))\nbms = []\ns = 5\nfor b, i in bs:\n s += b * (i - 1)\n bms.append((b, i, s))\n\n#print(bs)\n\n\n#m = 44852\nm = int(input())\n\nstack = [(m, 0, len... | ['Runtime Error', 'Accepted'] | ['s166202407', 's256761245'] | [3064.0, 3064.0] | [18.0, 21.0] | [898, 883] |
p03329 | u684026548 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['arr = [1]\nfor i in range(1, 10):\n if 6 ** i < 100000:\n arr.append(6 ** i)\n if 9 ** i < 100000:\n arr.append(9 ** i)\n\narr.sort(reverse=True)\n\nn = 44852\n#n = 127\n# n=3\n\n\ndef wari(k, l=0):\n # print(k)\n if k == 0:\n return l\n i = 0\n while k < arr[i]:\n i += 1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s038008655', 's723156740', 's630757559'] | [3064.0, 2940.0, 3064.0] | [18.0, 91.0, 188.0] | [601, 333, 321] |
p03329 | u686036872 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['list=[1, 1, 1, 1, 1]\nfor i in range(1, 7):\n list.append(6**i)\nfor j in range(1, 7):\n list.append(9**i)\nsorted(list, reverse=True)\nN=int(input())\ncount=0\nfor i in list:\n if N <= i:\n N=N-i\n count=+1\n if N==0:\n print(count)', 'list=[1, 1, 1, 1, 1]\nfor i in range(1, 7):\n list.append(6... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runti... | ['s261784515', 's268517354', 's406761192', 's409678670', 's430984278', 's445259893', 's449960828', 's484865367', 's506599904', 's530721869', 's585019728', 's620195522', 's632894938', 's637169479', 's663209486', 's686596431', 's716747815', 's732714373', 's814676711', 's997244195', 's169462212'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 3064.0, 2940.0, 3064.0, 2940.0, 2940.0, 3064.0, 3064.0, 3064.0, 2940.0, 2940.0, 3064.0, 3064.0, 2940.0, 2940.0, 8692.0] | [17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 17.0, 17.0, 17.0, 18.0, 21.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 18.0, 1179.0] | [241, 104, 241, 244, 226, 241, 251, 146, 205, 255, 129, 247, 249, 239, 246, 247, 239, 247, 241, 270, 251] |
p03329 | u690037900 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import bisect as bi\n\nli6 = [6 ** i for i in range(7)]\nli9 = [9 ** i for i in range(6)]\nprint(li6)\nprint(li9)\n\ndef s69(n):\n if n < 6:\n return n\n else:\n s6 = li6[bi.bisect(li6, n) - 1]\n s9 = li9[bi.bisect(li9, n) - 1]\n return min(n // s6 + s69(n % s6), 1 + s69(n - s9))\n\n... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s368371366', 's590560602', 's123236512'] | [3064.0, 3060.0, 3060.0] | [20.0, 18.0, 18.0] | [328, 287, 306] |
p03329 | u698176039 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\n\nl1 = 2 ** 30\np6 = [1] * 6\np9 = [1] * 5\nfor i in range(1,7):\n p6[i] = p6[i-1] * 6\n if i < 6 : p9[i] = p9[i-1] * 9\n\ndp = [l1] * (N+1)\ndp[0] = 0\n\nfor i in range(1,N+1):\n for j in p6:\n if j>i: break\n dp[i] = min(dp[i],dp[i-j]+1)\n \n for j in p9:\n ... | ['Runtime Error', 'Accepted'] | ['s985192720', 's466730660'] | [3064.0, 3828.0] | [19.0, 591.0] | [372, 372] |
p03329 | u698479721 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\ni = 0\nj = 0\na = [1,6,36,216,1296,7776,46656,9,81,729,6561,59049]\nb = a.sort(reverse=True)\nwhile N > 0:\n if a[j] > N:\n j += 1\n if a[j] = N:\n N = 0\n i += 1\n print(i)\n if a[j] < N:\n N = N-a[j]\n i += 1\n', 'N = int(input())\ndef six(n):\n i = 0\n while n%6 == 0:\n ... | ['Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted'] | ['s114176435', 's120771103', 's513309431', 's829796378', 's312303116'] | [2940.0, 3064.0, 3064.0, 3064.0, 3864.0] | [17.0, 2104.0, 2104.0, 18.0, 996.0] | [236, 344, 358, 397, 277] |
p03329 | u698771758 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N=int(input())\ndef cou(n,x):\n i=0\n while(n>0):\n i+=n%x\n n//=x\n return i\nans=N\nfor i in range(N+1):\n ans=min(ans,cou(j,6)+cou(N-j,9))\nprint(ans)', 'N=int(input())\ndef cou(n,x):\n i=0\n while(n>0):\n i+=n%x\n n//=x\n return i\nans=N\nfor j in range(N+1):\n ... | ['Runtime Error', 'Accepted'] | ['s022229547', 's849197280'] | [3060.0, 3060.0] | [17.0, 231.0] | [169, 169] |
p03329 | u701318346 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['\n\nN = int(input())\n\n\ndp = [10 ** 5] * N\nsix = [6 ** x for x in range(8)]\nnine = [9 ** x for x in range(6)]\n\n\ndp[0] = 1\n\n\nfor i in range(1, N):\n \n for s in six:\n if i + s >= N:\n break\n dp[i + s] = min(dp[i + s], dp[i] + 1)\n \n for n in nine:\n if i + n >= ... | ['Wrong Answer', 'Accepted'] | ['s044491292', 's974248845'] | [3828.0, 3828.0] | [746.0, 741.0] | [637, 803] |
p03329 | u703442202 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = input().split()\ncand = [1]\nfor i in range(1,6):\n for j in range(1,7):\n cand.append(6**j)\n cand.append(9**i)\nimport bisect \ncount = 0\ncand.sort()\nwhile n > 0:\n\tindex = bisect.bisect_left(cand, n)\n if index != 0\n n = n - cand[index-1]\n count += 1\n else:\n n -= 1\n co... | ['Runtime Error', 'Accepted'] | ['s823148718', 's524146706'] | [2940.0, 50408.0] | [17.0, 946.0] | [332, 490] |
p03329 | u710952331 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N = int(input())\n\nres = 100000\n\nfor i in range(N+1):\n t = i\n cc = 0\n while t>0:\n cc += t%6\n t = int(t/6)\n t = N-i\n while t>0:\n cc += t%9\n t = int(t/9)\n if res > cc:\n res = cc\n\nprint(cc)\n ', 'N = int(input())\n\nres = 100000\n\nfor i in range(N+1):\n cc = 0\n t = i\n while t>... | ['Wrong Answer', 'Accepted'] | ['s677164924', 's796988844'] | [3316.0, 3060.0] | [422.0, 430.0] | [209, 210] |
p03329 | u716649090 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N=int(input())\nans=N\nfor i in range(N+1):\n cnt=0\n while i>0:\n cnt+=i%6\n i//=6\n j=N-i\n while j>0:\n cnt+=j%9\n j//=9\n ans=min(ans,cnt)\nprint(ans)', 'N = int(input())\nans = N\nfor i in range(N + 1):\n cnt = 0\n t = i\n while t > 0:\n cnt += t % 6\n ... | ['Wrong Answer', 'Accepted'] | ['s739557034', 's901289220'] | [3060.0, 3060.0] | [323.0, 343.0] | [185, 226] |
p03329 | u726872801 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import sys\nimport heapq, math\nfrom itertools import zip_longest, permutations, combinations, combinations_with_replacement\nfrom itertools import accumulate, dropwhile, takewhile, groupby\nfrom functools import lru_cache\nfrom copy import deepcopy\n\nN = int(input())\n\ndp = [N] * (N + 1)\ndp[0] = 0\nfor i in range... | ['Time Limit Exceeded', 'Accepted'] | ['s192240456', 's617483437'] | [6664.0, 4468.0] | [2104.0, 883.0] | [617, 613] |
p03329 | u729133443 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['def s(n,p):\n while n>0:yield n%p;n//=p\nc=lambda*a:sum(s(*a))\nprint(min(c(i,6)+c(n-i,9)for i in range(int(input())+1)))', 'def s(a,b):return[s(a//b,b)+a%b,a][a<b]\nn=int(input());print(min(s(i,6)+s(n-i,9)for i in range(n+1)))', 'def s(n,p):\n while n>0:yield n%p;n//=p\nc=lambda*a:sum(s(*a));n=int(input())print(mi... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s078303204', 's106603389', 's297855811', 's720123697', 's970419886', 's976282702', 's183035637'] | [3060.0, 3860.0, 2940.0, 3060.0, 3056.0, 3840.0, 2940.0] | [17.0, 74.0, 17.0, 18.0, 18.0, 78.0, 244.0] | [119, 101, 122, 207, 119, 98, 102] |
p03329 | u747602774 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['from bisect import bisect_right\nN = int(input())\nli = sorted([1]+[6**i for i in range(1,10)]+[9**i for i in range(1,8)])\nprint(li)\nans = N%3\nN -= ans\nwhile N >= 36:\n a = bisect_right(li,N)\n N -= li[a-1]\n ans += 1\nif N == 3:\n ans += 3\nelif N <= 9:\n ans += 1\nelif N <= 18:\n ans += 2\neli... | ['Wrong Answer', 'Accepted'] | ['s977140624', 's801108573'] | [3064.0, 3864.0] | [18.0, 675.0] | [337, 332] |
p03329 | u754022296 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['d = tuple([1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)])\nM = 10**6+1\nB = [float("inf")]*M\nB[0] = 0\nfor i in range(M):\n for j in d:\n if i+j < M:\n B[i+j] = min(B[i+j], B[i]+1)\nn = int(input())\nprint(B[n])', 'd = tuple([1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)])\n... | ['Time Limit Exceeded', 'Accepted'] | ['s857577426', 's891083565'] | [10868.0, 3956.0] | [2104.0, 675.0] | [229, 229] |
p03329 | u756988562 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import sys\nN = int(input())\n# judge = True\nans = 0\ntemp = 9\ntemp_list = [1,2,3,4,5]\nwhile 100000>temp:\n temp_list.append(temp)\n temp *=9 \ntemp = 6\nwhile 100000>temp:\n temp_list.append(temp)\n temp *=6 \ntemp_list=sorted(temp_list)\n# print(temp_list)\nfor i in range(1,len(temp_list)+1):\n if... | ['Wrong Answer', 'Accepted'] | ['s947058922', 's670340304'] | [3064.0, 3864.0] | [18.0, 612.0] | [1208, 384] |
p03329 | u757446793 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import math\n\nN = int(input())\nmemo = [0]*(N+1)\nmemo[0] = 0\n\nfor i in range(1,N+1):\n\tmemo[i] = memo[i-1]+1\n\tfor j in range(1,iny(math.log(i,6))+1):\n\t\tmemo[i] = min(memo[i],memo[i-pow(6,j)]+1)\n\tfor j in range(1,int(math.log(i,9))+1):\n\t\tmemo[i] = min(memo[i],memo[i-pow(9,j)]+1)\n\nprint(memo[-1])\n', '... | ['Runtime Error', 'Accepted'] | ['s526180836', 's139460982'] | [3828.0, 3828.0] | [19.0, 1222.0] | [293, 289] |
p03329 | u759651152 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["#-*-coding:utf-8-*-\nfrom collections import deque\n\ndef nearest_num_six(n):\n temp = 1\n if n < 6:\n return n -1\n else:\n while n > temp:\n temp *= 6\n return n - temp // 6\n\ndef nearest_num_nine(n):\n temp = 1\n if n < 9:\n return n -1\n else:\n whi... | ['Wrong Answer', 'Accepted'] | ['s288039281', 's608444402'] | [3808.0, 3992.0] | [48.0, 380.0] | [822, 678] |
p03329 | u761989513 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['n = int(input())\n\nans = 0\nwhile n > 0:\n nine = 0\n while 9 ** nine <= n:\n nine += 1\n\n six = 0\n while 6 ** six <= n:\n six += 1\n\n print(n, max(9 ** (nine - 1), 6 ** (six - 1)))\n n -= max(9 ** (nine - 1), 6 ** (six - 1))\n ans += 1\n\nprint(ans)', 'n = int(input())\n\ndp = ... | ['Wrong Answer', 'Accepted'] | ['s170177412', 's725192965'] | [3064.0, 3828.0] | [17.0, 791.0] | [273, 304] |
p03329 | u762557532 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ["\n\nimport numpy as np\nfrom collections import deque\n#from copy import deepcopy\n\nN = int(input())\n\n## 6^6 < 1e5 < 6^7\n## 9^5 < 1e5 < 9^6\n\n\n\n\n\ndrawable_6 = sorted([6, 6**2, 6**3, 6**4, 6**5, 6**6], reverse=True)\ndrawable_9 = sorted([9, 9**2, 9**3, 9**4, 9**5, 9**6], reverse=True)\nsolver = []\n\nif N < 6... | ['Wrong Answer', 'Accepted'] | ['s879911083', 's227721825'] | [266344.0, 4152.0] | [2126.0, 127.0] | [2026, 915] |
p03329 | u763968347 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import math\n\nN = int(input())\nans = N\n\nfor N1 in range(N):\n \n count = 0\n N2 = N - N1\n\n while N1 > 0:\n count += N1%6\n N1 = math.floor(N1/6)\n print(N1)\n print(count)\n \n while N2 > 0:\n count += N2%9\n N2 = math.floor(N2/9)\n \n if ans > count... | ['Wrong Answer', 'Accepted'] | ['s018757194', 's119873621'] | [5988.0, 3828.0] | [955.0, 828.0] | [331, 379] |
p03329 | u774539708 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['N=int(input())\ndef money(n):\n dp=[n]*(n+1)\n dp[0]=0\n for i in range(1,n+1):\n power=1\n while power<=i:\n dp[i]=min(dp[i],dp[i-power]+1)\n power*=6\n power=1\n while power<=i:\n dp[i]=min(dp[i],dp[i-power]+1)\n power*=9\n print(dp... | ['Wrong Answer', 'Accepted'] | ['s332209529', 's229863063'] | [4848.0, 3828.0] | [393.0, 390.0] | [339, 325] |
p03329 | u776929617 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['import math\n\nN = int(input())\n\nans = 0\n\nc = int(math.pow(N, (1.0/9.0))+1)\n\nwhile c > 0:\n\tif N >= 9**c:\n\t\tN-=9**c\n\t\tans+=1\n\t\tc+=1\n\tc-=1\n\t\nc = int(math.pow(N, (1.0/6.0))+1)\nwhile c > 0:\n\tif N >= 6**c:\n\t\tN-=6**c\n\t\tans+=1\n\t\tc+=1\n\tc-=1\nprint(ans+N)', '\nN = int(input())\n\nans = 1000... | ['Wrong Answer', 'Accepted'] | ['s192574113', 's260423804'] | [3064.0, 3064.0] | [17.0, 292.0] | [243, 237] |
p03329 | u780962115 | 2,000 | 262,144 | To make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation: * 1 yen (the currency of Japan) * 6 yen, 6^2(=36) yen, 6^3(=216) yen, ... * 9 yen, 9^2(=81) yen, 9^3(=729) yen, ... At least how many operations are required to withdraw ... | ['lists=[0 for j in range(1000)]\nn=int(input())\nnums=0\nwhile nums!=n+1:\n \n \n if nums<6:\n lists[nums]==nums\n nums=+1\n elif nums==6 or nums==36 or nums==216 or nums==1296 or nums==7726 or nums==46656:\n lists[nums]==1\n nums+=1\n elif nums==9 or nums==81 or nums==729 or... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s051347168', 's055662989', 's180034016'] | [3064.0, 102448.0, 4724.0] | [2109.0, 2108.0, 1218.0] | [1101, 1099, 298] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.