
递归题
真的是沐白
前端开发
展开
-
求数组的深度
function getArrayDepth(arr) { const depths = [] arr.forEach( ele => { let depth = 0 if (Array.isArray(ele)) { depth = getArrayDepth(ele) } depths.push(depth) }) retur...原创 2020-02-10 19:18:36 · 1602 阅读 · 0 评论 -
opj线性表Placing apples 题解
4:Placing apples 总Time Limit: 1000msMemory Limit: 65536kB Description We are going to place M same apples into N same plates. There could be some empty plates. How many methods do we have? Whe原创 2017-03-26 20:02:05 · 800 阅读 · 0 评论 -
递归基础题:汉诺塔
输入数字n,表示有n个盘子,问有多少种可能?并输出每一步的方法 #include char x='x',y='y',z='z'; int num=0; void hanio(int n,char x, char y,char z) { if(n==1){ printf("%d move %d from %c to %c\n",++num,n,x,z);原创 2017-03-26 20:50:32 · 381 阅读 · 0 评论 -
How far away ?
How far away ? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19131 Accepted Submission(s): 7485 Problem Description There are n ho原创 2017-12-07 00:18:01 · 733 阅读 · 0 评论