public static int solution(int len, int gridLen, int x, int y) { //每一行或者每一列有多少个格栅 int per = len / gridLen; //这个行列是格栅的行列 都是从一开始算起 int row = x / gridLen + 1; int col = y / gridLen + 1; int res; if (row == 1) { res = col; } else { res = per * (row - 1) + col; } return res; }

相关推荐

孙艹肘:校招不给三方直接让实习我都去了,,主打一个在学校呆着也是闲着,不如出来实习一下
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务