Advertisement
tungSfer

thuyen nhan vien nhuan

Jan 16th, 2022
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. class nhanvien:
  2.     def __init__(self, hoten, lt, th):
  3.         self.hoten = hoten
  4.         self.lt = lt
  5.         self.th = th
  6.         self.tb=0
  7.         self.loai=""
  8.     def tinh(self):
  9.         if self.lt>10: self.lt/=10
  10.         if self.th>10: self.th/=10
  11.         self.tb=(self.lt+self.th)/2
  12.         if self.tb<5: self.loai="TRUOT"
  13.         elif self.tb>=5 and self.tb<8: self.loai="CAN NHAC"
  14.         elif self.tb>=8 and self.tb<9.5: self.loai="DAT"
  15.         else: self.loai="XUAT XAC"
  16.     def inra(self):
  17.         self.tb=format(self.tb, ".2f")
  18.         print(f"{self.hoten} {self.tb} {self.loai}")
  19. res=[]
  20. for t in range(int(input())):
  21.     res.append(nhanvien(input(), float(input()), float(input())))
  22. for i in res: i.tinh()
  23. res.sort(key=lambda x:(-x.tb, x.hoten))
  24. for i in res: i.inra()
  25. '''
  26. 3
  27. Nguyen Thai Binh
  28. 45
  29. 75
  30. Le Cong Hoa
  31. 4
  32. 4.5
  33. Phan Van Duc
  34. 56
  35. 56
  36. '''
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement