代码 #!/usr/bin/env python # -*- coding: utf-8 -*- # author: a2htray # create date: 2023/3/4 """ PAT 乙级 1015 """ from functools import cmp_to_key def sort_students(student1, student2): total1 = sum(student1[1:]) total2 = sum(student2[1:]) if total1 != total2: return -1 if total1 > total2 else 1 elif student1[1] !=...
代码 #!/usr/bin/env python # -*- coding: utf-8 -*- # author: a2htray # create date: 2023/3/4 """ PAT 乙级 1014 """ week_dict = { 'A': 'MON', 'B': 'TUE', 'C': 'WED', 'D': 'THU', 'E': 'FRI', 'F': 'SAT', 'G': 'SUN', } hour_dict = { '0': '00', '1': '01', '2': '02', '3': '03', '4': '04', '5': '05', '6': '06', '7': '07', '8':...
代码 # basic_1002.py chinese_pinyins = [ 'ling', 'yi', 'er', 'san', 'si', 'wu', 'liu', 'qi', 'ba', 'jiu', ] if __name__ == '__main__': num_chars = input() total = 0 for num_char in num_chars: total += int(num_char) output = [] for num_char in str(total): output.append(chinese_pinyins[int(num_char)]) print('...
代码 # basic_1001.py if __name__ == '__main__': n = int(input()) step = 0 while n != 1: if n % 2 == 0: n = n // 2 else: n = (3 * n + 1) // 2 step += 1 print(step) 运行 input: 100 output: 18
有幸搞了个 CSIG 的线上面试,感觉是“没什么感觉”,一般般吧,没过。
前面介绍什么就不说了,我这边没突出什么工作亮点,然后就直接共享桌面写代码了。题目是编程实现一个由字符串数组表示的大数的除以 9 的计算,后面又追问了小数点后值如何保存,所以索性在线下实现也写了写。