8月6号阿里笔试




同时附上AC代码

第一题  新世界
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
 
using namespace std;
 
int d, m, w;
int i, j, k;
typedef long long ll;
 
int main() {
    scanf("%d%d%d", &d, &m, &w);
    scanf("%d%d%d", &i, &j, &k);
     
    ll y = m * d;
    ll total = (k - 1) * y + (j - 1) * d + i;
    ll res = (total - 1) % w;
    printf("%c\n", 'a' + res);
    return 0;
}

第二题 余数联盟
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
 
using namespace std;
 
const int N = 10010;
 
int p[N];
int n;
int a, b, c, t;
 
int find(int x) {
    if (x != p[x]) p[x] = find(p[x]);
    return p[x];
}
 
int main() {
    scanf("%d", &n);
    for (int i = 0; i < N; i++) p[i] = i;
     
    while (n--) {
        scanf("%d", &t);
        if (t == 1) {
            scanf("%d%d", &a, &b);
            int pa = find(p[a]);
            int pb = find(p[b]);
            if (pa != pb)
                p[pa] = pb;
        } else {
            scanf("%d%d%d", &a, &b, &c);
            a = a % c;
            b = b % c;
            if (find(p[a]) == find(p[b])) puts("YES");
            else puts("NO");
        }
    }
}
#阿里巴巴2021校招##笔经##阿里巴巴#
全部评论

相关推荐

运营你豪哥:简历改改吧-非本、求职意向技术岗、无实习经历、内容空洞 如果简历不爆改的话,应该是会持续崩溃了 1.把你教育经历放最下面去 2.蓝底照片很奇怪哈,感觉还在高中时代,建议白底重新拍一下 3.校园经历没啥必要,收集和反馈同学们对产品的意见,解决学生和老师之间的沟通,企业招聘不看这些哈 好好思考一下简历的设计和你要表达的重点,再去投简历
点赞 评论 收藏
分享
评论
点赞
1
分享

创作者周榜

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