Advertisement
DialOG_

Untitled

Feb 28th, 2021
624
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. f = open('1.txt')
  2.  
  3. n = int(f.readline())
  4.  
  5. k3 = k7 = k21 = 0
  6. for i in range(n):
  7.     x = int(f.readline())
  8.     if x % 21 == 0:
  9.         k21 +=1
  10.     elif x % 7 == 0:
  11.         k7 +=1
  12.     elif x % 3 == 0:
  13.         k3 +=1
  14. s =(n*(n-1)//2) -(k3*k7 + k21*(n-k21)+k21*(k21-1)//2)
  15. print(s)
  16.        
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement