全部评论
难道不是直接准备秋招??😂
华为笔试不过,秋招就没面试机会了么?
我把题解思路写出来了 https://www.nowcoder.com/discuss/179895 可以参考下
我也一题没AC😭
今天的不是挺简单的吗
1. 枚举所有permutation,找出合法的最大时间 2. 把所有商品按成本排序,从成本最小的商品开始买,如果本次收益为正则购买,本钱加上本次收益,遇到本钱买不起的商品结束 3. 维护cpus和jobs两个list,均按降序排列,初始时cpus = [0] * m。每次cpus和jobs pop出最后一个元素cpu和job,cpu和job相加插入到cpus首位。到jobs为空停止。cpus[0]即为所求。
IN = [int(x) for x in input().replace('[', '').replace(']', '').split(',')]
times = []
for a in range(6):
for b in range(6):
for c in range(6):
for d in range(6):
for e in range(6):
for f in range(6):
if a != b and a != c and a != d and a != e and a != f and b != c and b != d and b != e and b != f and c != d and c != e and c != f and d != e and d != f and e != f:
times.append([IN[a] * 10 + IN[b], IN[c] * 10 + IN[d], IN[e] * 10 + IN[f]])
res = [-1, -1, -1]
for each in times:
hour = each[0]
m = each[1]
s = each[2]
if hour < 24 and m < 60 and s < 60:
if hour > res[0]:
res[0] = hour
res[1] = m
res[2] = s
elif hour == res[0] and m > res[1]:
res[0] = hour
res[1] = m
res[2] = s
elif hour == res[0] and m == res[1] and s > res[2]:
res[0] = hour
res[1] = m
res[2] = s
if sum(res) == -3:
print("invalid")
else:
print(str(res[0]).zfill(2) + ':' + str(res[1]).zfill(2) + ':' + str(res[2]).zfill(2))
a = [int(x) for x in input().split(',')]
b = [int(x) for x in input().split(',')]
c = int(input())
t = list(zip(a, b))
t.sort()
for i in range(len(t)):
if t[i][0] > c:
break
if t[i][0] >= t[i][1]:
continue
c += t[i][1] - t[i][0]
print(c)
m, n = [int(x) for x in input().split()]
jobs = [int(x) for x in input().split()]
jobs.sort(reverse=True)
cpus = [0] * m
while jobs:
cpu = cpus.pop()
job = jobs.pop()
cpu = cpu + job
cpus.insert(0, cpu)
print(cpus[0])
5月还有笔试吗?
相关推荐
10-24 14:56
门头沟学院 测试工程师 点赞 评论 收藏
分享
10-17 15:59
东南大学 Java 点赞 评论 收藏
分享