今天线下宣讲遇到这题,最后才做出来 关键是最后要递归到1级宝石才可以保证用的最少 public int getNum(int level){ return helper(level,1); } public static int helper(int level,int coff){ if(level == 1)return level*coff; int coff5 = coff/2; int coff3 = coff%2; return helper(level-1,coff5*5+coff3*3); }
牛客网
牛客企业服务