Blue Bridge Cup Python Group - Decomposition of Numbers

Blue Bridge Cup Python Group - Decomposition of Numbers

insert image description here

import os
import sys
def check(x):
  y=str(x)
  if '2' in y or '4' in y:
    return 0
  else:
    return 1
s = 0
for i in range(1,672):
    for j in range(i + 1,1009):
        k = 2019 - i - j
        if i < j < k and check(i) == 1 and check(j) == 1 and check(k):
          s += 1
print(s)

The final answer is 40785
Thank you for your support. Your one-click three-connection is the biggest driving force for Ganggang students!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324320874&siteId=291194637