第一题数学题 第二题 考完三分钟才写出来的 心态崩了 提交的时候我就知道错的 可是就差一点点了 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-22 09:42
门头沟学院 Java
牛客37185681...:马德,我感觉这是我面过最恶心的公司,一面是两个女hr,说什么实习前几个月属于试用期,试用期过了才能转成正式实习生,我***笑了,问待遇就是不说,问能不能接受全栈,沙币公司
如果可以选,你最想去哪家...
点赞 评论 收藏
分享
迷茫的大四🐶:价格这么低都能满了?
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务