dxnge

22

Oct 21st, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. with open('17.txt') as f:
  2.     cnt, minim, maxim = 0, float('inf'), float('-inf')
  3.     while a := f.readline():
  4.         x = int(a)
  5.         b = 0
  6.         for d in (2, 3, 5, 7):
  7.             if x % d == 0:
  8.                 b += 1
  9.         if b == 2:
  10.             cnt += 1
  11.             if minim > x:
  12.                 minim = x
  13.             if maxim < x:
  14.                 maxim = x
  15. print(cnt, minim + maxim)
Advertisement
Add Comment
Please, Sign In to add comment