Pony.ai 笔试

第一题 暴力AC

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static int[] check(int[] a) {
        int n = a.length;
        int[] c = new int[n];
        c[0] = a[0];
        int d = a[1] - a[0];
        for (int i = 1; i < n; i++) {
            c[i] = c[i - 1] + d;
            if (c[i] < 0) {
                return null;
            }
            if (c[i] % a[i] > 0) {
                return null;
            }
            int t = c[i] / a[i];
            if ((t & (t - 1)) != 0) {
                return null;
            }
        }
        return c;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        int x = a[0];
        int y = a[1];
        for (int i = 0; i < 100; i++) {
            for (int j = 0; j < 100; j++) {
                a[0] <<= i;
                a[1] <<= j;
                int[] c = check(a);
                if (c != null) {
                    Arrays.stream(c).forEach(System.out::println);
                    return;
                }
                a[0] = x;
                a[1] = y;
            }
        }
    }
}

第二题. 76%
最后2分钟想到坑点了

BBBBBW
WWWW..
BBBBBW
WWWW..

这种情况是不合法的
但是

BBBBB
....B
....B
....B
....B

是合法的。
可惜已经没空写了。
第三题。物理渣。理化生就物理最差。混了个64%。刚刚看有个大佬AC了,也发帖了,可以参考他的。

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        while (n-- > 0) {
            /*
            x = rcosθ+x0-r
            y = rsinθ+y0
             */
            double l0, v0, l1, v1, x0, y0, r, x1, y1;
            l0 = in.nextInt();
            v0 = in.nextInt();
            l1 = in.nextInt();
            v1 = in.nextInt();
            x0 = in.nextInt();
            y0 = in.nextInt();
            r = in.nextInt();
            x1 = in.nextInt();
            y1 = in.nextInt();
            double θ = Math.acos((x1 + r - x0) / r);
            double inR = θ * r;
            double outR = inR + l0;
            double tAin = inR / v0;
            double tAout = outR / v0; // tAin .. tAout
            double y2 = r*Math.sin(θ)+y0;
            double y3 = y2-l1;
            double tBin = (y1 - y2) / v1;
            double tBout = (y1 - y3) / v1;
            if (tAout <= tBin  || tBout <= tAin) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
    }
}
#笔试题目##题解##小马智行#
全部评论
第二题直接搜索79% import sys def dfs(board, x, y, last_dir, count, cls):     if count == 5:         return True     if not last_dir:         for each_dir in DIR:             temp_x = x + each_dir[0]             temp_y = y + each_dir[1]             if 0 <= temp_x < N and 0 <= temp_y < N and board[temp_x][temp_y] == cls:                 rvt = dfs(board, temp_x, temp_y, each_dir, count + 1, cls)                 if rvt:                     return True     else:         temp_x = x + last_dir[0]         temp_y = y + last_dir[1]         if 0 <= temp_x < N and 0 <= temp_y < N and board[temp_x][temp_y] == cls:             rvt = dfs(board, temp_x, temp_y, last_dir, count + 1, cls)             if rvt:                 return True     return False if __name__ == '__main__':     N = 15     DIR = [[1, 0], [0, 1], [-1, 1], [1, 1]]     chess_board = []     for i in range(N):         temp = sys.stdin.readline().strip()         chess_board.append(temp)     count_white, count_black = 0, 0     for i in range(N):         count_white += chess_board[i].count('W')         count_black += chess_board[i].count('B')     if count_white > count_black or count_black > count_white + 1:         print("invalid board")     else:         rvt_w, rvt_b = False, False         for i in range(N):             if rvt_w:                 break             for j in range(N):                 if chess_board[i][j] == 'W':                     rvt_w = dfs(chess_board, i, j, None, 1, 'W')                     if rvt_w:                         break         for i in range(N):             if rvt_b:                 break             for j in range(N):                 if chess_board[i][j] == 'B':                     rvt_b = dfs(chess_board, i, j, None, 1, 'B')                     if rvt_b:                         break         if not rvt_w and not rvt_b:             if count_white + count_black == N * N:                 print("draw")             else:                 print("not finished")         elif rvt_w:             if count_white == count_white:                 print("white win")             else:                 print("invalid board")         elif rvt_b:             if count_black > count_white:                 print("black win")             else:                 print("invalid board")
2 回复 分享
发布于 2018-09-19 22:51
去面过了,前面主要就是写题,后面换人瞎聊
点赞 回复 分享
发布于 2018-09-20 01:36
第二题我估计要很久,找了个48%就跳过去了,做完第三题剩几分钟,就没做第二题,求分享第二题思路
点赞 回复 分享
发布于 2018-09-19 22:42

相关推荐

已经入职字节快一个月了,突然想起来之前那段时间的面经没有发,先发一下timeline吧。Tiktok&nbsp;内容安全平台(人才库电话捞我):电话10.28&nbsp;-&gt;&nbsp;一面10.30(我觉得你跟我们组业务挺match的,然后过了三天问hr挂了,应该是别人流程更快)阿里淘天:投递11.11-&gt;约面11.12-&gt;一面11.14(问得很简单,30分钟,手撕八股全过无后续)Kpi面腾讯wxg&nbsp;微信小程序:投递11.13&nbsp;-&gt;约面11.14-&gt;&nbsp;一面11.17&nbsp;(究极无敌拷打,问我多模态大模型涉及的算法?但是人很好)-&gt;11.19流程终止小红书&nbsp;风控平台:投递11.16&nbsp;—约面11.17&nbsp;&nbsp;-&gt;一面11.18&nbsp;(抽象的面试官,面试感觉一般,问得前端网页安全相关的,确实没准备)-&gt;11.20挂百度&nbsp;百家号:投递11.14&nbsp;—&gt;约面11.14&nbsp;-&gt;一面11.14(当场约2面)-&gt;二面11.24-&gt;口头告知offer,&nbsp;拒绝(原因是业务不太好)美团&nbsp;技术平台投递11.17&nbsp;-&gt;&nbsp;约面(忘记了,没多久)&nbsp;-&gt;一面11.19&nbsp;-&gt;二面11.21&nbsp;(字节offer不想面了)快手&nbsp;电商业务投递11.17&nbsp;-&gt;&nbsp;约面11.18&nbsp;-&gt;一面11.19&nbsp;-&gt;&nbsp;二面11.21(拒了)腾讯wxg&nbsp;微信支付(被捞):(直接发面试邮件)技术一面12.05&nbsp;-&gt;技术二面12.11&nbsp;-&gt;技术三面12.17&nbsp;-&gt;&nbsp;hr面已拒绝(了解业务后拒绝,但是有转正hc,感觉还蛮可惜)字节跳动&nbsp;xxxx:东家就不放具体的时间线了,大概是面完第二天就能知道结果,除了有几天ld请假了没填面评。不去wxg还有个原因是还在期末周,深圳学校来回太麻烦了,至少现在在的组感觉能学到很多的东西,自己的选择应该也没错。还是感概一下,一年前大二的时候投简历海投基本上石沉大海,无论大小厂约面比例很少。现在基本上投了就有面试,还都是以前梦寐以求的大厂,现在自己也有了更多的选择,也没有投太多简历。也感谢上一段实习的经历,很有意思的项目,无论是字节,腾讯,还是美团基本都有聊这个项目。面经需要等一下,也许等周末有空了再发给各位uu,感兴趣可以关注一下~有想要交流学习的同学也可以私信我,目前人在北京大钟寺~,可以找搭子~
正能量的牛可乐:这么多大厂面试下来,不仅摸清了不同公司的面试风格,还能精准避雷业务不匹配的岗位,血赚
实习简历求拷打
点赞 评论 收藏
分享
评论
点赞
9
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务