Advertisement
C3EQUALZ

Задание 14 ЕГЭ

Nov 15th, 2021 (edited)
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.80 KB | None | 0 0
  1. Pascal abc.net:
  2. ///Сколько единиц содержится в двоичной записи значения выражения: 42020 + 22017 – 15?
  3. ###
  4. var count:=0;
  5. var s:=4bi**2020 + 2bi**2017 - 15;
  6. while s>0 do begin
  7.   if s mod 2=1 then count+=1; s:=s div 2;
  8. end;
  9. count.Pr
  10. --------------------------------------------------------------------------------------------------------------------------
  11. Python:
  12. count = 0
  13. s = 4**2020 + 2**2017 - 15
  14. while s > 0:
  15.     if s % 2 == 1:
  16.         count += 1
  17.     s //= 2
  18. print(count)
  19.  
  20. Pyhton:
  21. a = pow(6,203) + 5*pow(6,405) - 3*pow(6,144) + 76
  22. def numeral_system_сhange(a : int, new_system: int) -> list:
  23.     lst = []
  24.     while a > 0:
  25.         lst.insert(0, a % new_system)
  26.         a //= new_system
  27.     return lst
  28. print(*numeral_system_сhange(a, 6))
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement