第一题数学题 第二题 考完三分钟才写出来的 心态崩了 提交的时候我就知道错的 可是就差一点点了 public long query(long x,long y,long nums[][]) { if(x<3 && y<3) { return nums[(int) (x-1)][(int)(y-1)]; } else { int i=0,j=0; long temp=x-1; while(temp>0) { i++; temp=temp/2; } temp = y-1; while(temp>0) { j++; temp=temp/2; } if(i==j) { i--; j--; return query((long)(x-Math.pow(2, i)),(long)(y-Math.pow(2, j)),nums)+nums[1][1]; }else if(i>j) { i--; return query((long)(x-Math.pow(2, i)),y,nums)+nums[1][0]; }else { j--; return query(x,(long)(y-Math.pow(2, j)),nums)+nums[0][1]; } } }
点赞 5

相关推荐

09-26 21:43
已编辑
重庆邮电大学 Java
Yki_:这简历一看就是雯哥和小傅哥带出来的兵,我简历基本上跟你一模一样
写简历别走弯路
点赞 评论 收藏
分享
牛客吹哨人:哨哥晚点统一更新到黑名单:能救一个是一个!26届毁意向毁约裁员黑名单https://www.nowcoder.com/discuss/1525833
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务