Problem:


Score : 300 points

Problem Statement

You are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally "Seven-Five-Three numbers") are there?

Here, a Shichi-Go-San number is a positive integer that satisfies the following condition:

When the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.

Constraints

1 \leq N < 10^9

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of the Shichi-Go-San numbers between 1 and N (inclusive).

Sample Input 1

575

Sample Output 1

4

There are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.

Sample Input 2

3600

Sample Output 2

13

There are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.

Sample Input 3

999999999

Sample Output 3

26484



Sample input:
575


Sample output:
4

Submission status: Wrong Answer

Solution code:
import itertools

N = int(input())

arr = ["3","5","7"]
res = 0

for i in itertools.permutations(arr, 3):
    val = int(str(i[0]+i[1]+i[2]))
    if N < val:
        continue
    res += 1

print(res)

Submission status: Wrong Answer

Solution code:
import itertools
import copy as cp
X = int(input())
X_l = len(str(X))
n = ['3','5','7']
comb = ['357']
all_comb = []
all_ans = []
for i in range(X_l - 3):
  tmp_comb = cp.copy(comb)
  for co in tmp_comb:
    for key in n:
      newco = cp.copy(co)
      newco = newco + key
      newco = sorted(newco)
      comb.append(''.join(newco))
comb = list(set(comb))
for co in comb:
  co = [i for i in co]
  for c in itertools.permutations(co, len(co)):
    all_comb.append(c)
for nums in list(set(all_comb)):
  num = int(''.join(nums))
  if num < X:
    all_ans.append(num)
print(len(all_ans))

Submission status: Wrong Answer

Solution code:
X = int(input())
ans = []
for i in range(357, X):
  if i > X:
    break
  a = str(i)
  if a[-1] is not '3' and a[-1] is not '5' and a[-1] is not '7':
    continue
  a = ''.join(sorted(list(set(str(i)))))
  if a == '357':
    ans.append(i)
print(len(ans))

Submission status: Wrong Answer

Solution code:
import itertools
import copy as cp
X = int(input())
X_l = len(str(X))
n = ['3','5','7']
comb = [n]
all_comb = []
all_ans = []
if X < 357:
  print(0)
#comb.extend(itertools.permutations(n, len(tmp)))
#print(comb.append('a'))
for i in range(X_l - 3):
  tmp_comb = cp.copy(comb)
  for co in tmp_comb:
    for key in n:
      newco = cp.copy(co)
      newco.append(key)
      comb.append(newco)
for co in comb:
  for c in itertools.permutations(co, len(co)):
    all_comb.append(c)
#print(all_comb)  
for nums in list(set(all_comb)):
  num = int(''.join(nums))
  if num < X:
    all_ans.append(num)
print(len(all_ans))

Submission status: Wrong Answer

Solution code:
import itertools
import copy as cp
X = int(input())
X_l = len(str(X))
n = ['3','5','7']
comb = [n]
all_comb = []
all_ans = []
if X < 357:
  print(0)
#comb.extend(itertools.permutations(n, len(tmp)))
#print(comb.append('a'))
for i in range(X_l - 3):
  tmp_comb = cp.copy(comb)
  for co in tmp_comb:
    for key in n:
      newco = cp.copy(co)
      newco.append(key)
      comb.append(newco)
for co in comb:
  for c in itertools.permutations(co, len(co)):
    all_comb.append(c)
#print(all_comb)  
for nums in list(set(all_comb)):
  num = int(''.join(nums))
  if num < X:
    print(num)
    all_ans.append(num)
print(len(all_ans))

Submission status: Wrong Answer

Solution code:
x = int(input())

count = 0

for i in range(x):
    y = str(i)

    count3 = 0
    count5 = 0
    count7 = 0

    bool = False

    for j in range(len(y)):
        if y[j] == '1' or y[j] == '2' or y[j] == '4' or y[j] == '6' or y[j] == '8' or y[j] == '9' or y[j] == '0':
            bool = True
            break
            
    if bool:
        continue

    for j in range(len(y)):
        if y[j] == '3':
            count3 = 1
        if y[j] == '5':
            count5 = 1
        if y[j] == '7':
            count7 = 1
    
    if count3 == 1 and count5 == 1 and count7 == 1:
        count += 1

print(count)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

N = int(input())
ans = 0
for i in range(N):
    i = str(i)
    s = i.count("7")
    f = i.count("5")
    t = i.count("3")
    if s+f+t == len(i) and s > 0 and t>0 and f>0:
        ans = ans+1
print(ans)

Submission status: Wrong Answer

Solution code:
def change_ten_to_kisu(num, kisu):      # 10進数をkisu進数に変換 (int, int) => int
    r = 0
    syo = num
    count = 0
    while syo >= kisu:
        r += (syo % kisu) * 10 ** count
        syo = syo // kisu
        count += 1
    return r + syo * 10 ** count

def change_kisu_to_ten(num, kisu):      # kisu進数を10進数に変換 (int, int) => int
    n = str(num)
    r = 0
    for i in range(len(n)):
        r += int(n[-i - 1]) * kisu ** i
        # print(r, int(n[-i - 1]), kisu ** i)
    return r

def plus(num):                   # 3, 5, 7のみを使用しnumより大きい数を返す
    change = {"3" : "1", "5" : "2", "7" : "3"}
    change_r = {"1" : "3", "2" : "5", "3" : "7"}
    t = ""
    for i in str(num):
        t += change[i]
    r = change_ten_to_kisu(change_kisu_to_ten(int(t), 4) + 1, 4)
    if "0" in str(r):
        r = str(r).replace("0", "1")     
    t = ""
    for i in str(r):
        t += change_r[i]
    return int(t)

N = int(input())

i = 3
count = 0
while i < N:
    if "3" in str(i) and "5" in str(i) and "7" in str(i):
        # print(i)
        count += 1
    i = plus(i)
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
for i in range(1, N + 1):
    if "0" in str(i) and "1" in str(i) and "2" in str(i):
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())

count = 0
for i in range(N):
	if set(str(i)) != {"3", "5", "7"}:
		continue
	count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = input()
l = int(N[0])
i = (int(N[0])-1)//2
if l==9:
    i=3
if i == 0:
    con = 0
if i==1:
    con=i*3**(len(N)-1)-2*2**(len(N)-1)+2
if i==2:
    con=i*3**(len(N)-1)-2*2**(len(N)-1)-2*1*2**(len(N)-1)+2
if i==3:
    con=3**(len(N))-3*2**(len(N))+3
if len(N)!=3:
    for k in range(len(N)-3):
        con += 3**(len(N)-k-1)-3*2**(len(N)-k-1)+3
print(int(con))

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt = 0
for i in range(357, N):
  l = map(int, list(str(i)))
  a_3,  a_5, a_7 = False, False, False
  for j in l:
    if j == 3:
      a_3 = True
    elif j == 5:
      a_5 = True
    elif j == 7:
      a_7 = True
    else:
      break
  if a_3 == a_5 == a_7 == True:
    cnt += 1
print(cnt)

Submission status: Wrong Answer

Solution code:
n=int(input())
c=0
l=[3,5,7]
L=[]
for i1 in l:
  for i2 in l:
    for i3 in l:
      for i4 in l:
        for i5 in l:
          L.append(10000*i1+1000*i2+100*i3+10*i4+i5)
for i in range(min(n+1,10000)):
  l=str(i)
  if '3' in l and '5' in l and '7' in l and '0' not in l and '1' not in l and '2' not in l and '4' not in l and '6' not in l and '8' not in l and '9' not in l:c+=1
for j in L:
  for i in range(j,n+1,100000):
    l=str(i)
    if '3' in l and '5' in l and '7' in l:c+=1
print(c)

Submission status: Wrong Answer

Solution code:
n=int(input())
c=0
l=[3,5,7]
L=[]
for i1 in l:
  for i2 in l:
    for i3 in l:
      for i4 in l:
        for i5 in l:
          L.append(10000*i1+1000*i2+100*i3+10*i4+i5)
for i in range(min(n+1,10000)):
  l=str(i)
  if '3' in l and '5' in l and '7' in l:c+=1
for j in L:
  for i in range(j,n+1,100000):
    l=str(i)
    if '3' in l and '5' in l and '7' in l:c+=1
print(c)

Submission status: Wrong Answer

Solution code:
def is753(n):
    s = str(n)
    ans = False
    if s.find('3') != -1 and s.find('5') != -1 and s.find('7') != -1:
        ans = True
    return ans

N = int(input())

nums = [3,5,7]
for i in range(8):
    PrevNums = nums.copy()
    for n in PrevNums:
        nums.append(n * 10 + 3)
        nums.append(n * 10 + 5)
        nums.append(n * 10 + 7)

nums = set(nums)
nums2 = list()
for n in nums:
    if is753(n) :
        nums2.append(n)

nums2.sort()
ans = 0
for i in range(len(nums2)):
    if nums2[i] >= N:
        ans = i
        break
    ans = len(nums2)
print(ans)

Submission status: Wrong Answer

Solution code:
def is753(n):
    s = str(n)
    ans = False
    if s.find('3') != -1 and s.find('5') != -1 and s.find('7') != -1:
        ans = True
    return ans

N = int(input())

nums = [3,5,7]
for i in range(8):
    PrevNums = nums.copy()
    for n in PrevNums:
        nums.append(n * 10 + 3)
        nums.append(n * 10 + 5)
        nums.append(n * 10 + 7)

nums = set(nums)
nums2 = list()
for n in nums:
    if is753(n) :
        nums2.append(n)

nums2.sort()
ans = -1
for i in range(len(nums2)):
    if nums2[i] >= N:
        ans = i
        break
if ans == -1:
    ans = len(nums2)
print(ans)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([0,0,0,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if int(N[i])==3:
        if i==len(N)-1:
            if check5 and check7:
              ans += 1
        check3 = True
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])<5:
        break
    if int(N[i])==5:
        if i==len(N)-1:
            if check5 and check7:
                ans += 1
            if check3 and check7:
                ans += 1
        check5 = True
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])<7:
        break
    if int(N[i])==7:
        check7 = True
        if i==len(N)-1:
            if check5 and check7:
                ans += 1
            if check3 and check7:
                ans += 1
            if check3 and check5:
                ans += 1
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    break

print(ans)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([0,0,0,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if int(N[i])==3:
        check3 = True
        if i==len(N)-1 and check7 and check5 and check3:
            ans += 1
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])<5:
        break
    if int(N[i])==5:
        check5 = True
        if i==len(N)-1 and check7 and check5 and check3:
            ans += 1
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])<7:
        break
    if int(N[i])==7:
        check7 = True
        if i==len(N)-1 and check7 and check5 and check3:
            ans += 1
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    break
else:
    if check3 and check5 and check7:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([1,0,0,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2
]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if int(N[i])==3:
        check3 = True
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])<5:
        break
    if int(N[i])==5:
        check5 = True
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])<7:
        break
    if int(N[i])==7:
        check7 = True
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    break
else:
    if check3 and check5 and check7:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0
not_match_num = ['0','1','2','4','6','8','9']
if N<357:
    print(0)
else:
    for num in range(357, N):
        if '3' in str(num) and '5' in str(num) and '7' in str(num):
            for i in range(len(not_match_num)):
                if not_match_num[i]  in str(num):
                    break
            else:
                count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = 0

for i in range(357, N+1):

    i_str = str(i)

    if i_str[-1] != "3" or i_str[-1] != "5" or i_str[-1] != "7":
        continue
 
    thr = i_str.count("3")
    fiv = i_str.count("5")
    sev = i_str.count("7")


    if len(i_str) == thr + fiv + sev:
        if thr > 0:
             if fiv > 0:
                if sev > 0: 
                    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
order = len(str(n))-1
number = order*(order-1)*(order-2)*3**(order-3)
for i in range(10**(order),n+1):
    l = list(str(i))
    if "7" in l and "5" in l and "3" in l:
        if not "0" in l and not "1" in l and not "2" in l and not "4" in l and not "6" in l and not "8" in l and not "9" in l:
            number += 1
print(int(number))

Submission status: Wrong Answer

Solution code:
n=int(input())
number=0
for i in range(1,n):
    l = list(str(i))
    if "7" in l and "5" in l and "3" in l:
        number += 1
print(number)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(100000)
ans = 0

def dfs(s, n):
    global ans
    if s == "":
        pass
    elif int(s) > n:
        return
    elif "3" in s and "5" in s and "7" in s and int(s) < n:
        # print(s)
        ans += 1

    for i in "753":
        dfs(s+i, n)


def main():
    global ans
    n = int(input())
    dfs("", n)
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(100000)
ans = 0

def dfs(s, n):
    global ans
    if s == "":
        pass
    elif "3" in s and "5" in s and "7" in s and int(s) < n:
        # print(s)
        ans += 1
    elif int(s) > n:
        return

    for i in "753":
        dfs(s+i, n)


def main():
    global ans
    n = int(input())
    dfs("", n)
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
ans = 0

def dfs(s, n):
    global ans
    if s == "":
        pass
    elif "3" in s and "5" in s and "7" in s and int(s) < n:
        # print(s)
        ans += 1
    elif int(s) > n:
        return

    for i in "753":
        dfs(s+i, n)

def main():
    global ans
    n = int(input())
    dfs("", n)
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
def C3():
    N = int(input())
    def make_list(s):
        S = [s]
        if int(s) <= N:
            S.extend(make_list(s + "3"))
            S.extend(make_list(s + "5"))
            S.extend(make_list(s + "7"))
        return S

    datalist = make_list("0")

    ans = 0
    for i in datalist:
        s = 0
        f = 0
        t = 0
        for j in list(i):
            print(j)
            if j == "7":
                s = 1
            if j == "5":
                f = 1
            if j == "3":
                t = 1
        if s + f + t == 3 and int(i) <= N:
            ans += 1
    print(ans)
C3()

Submission status: Wrong Answer

Solution code:
N = int(input())
count = int(0)
for i in range(0, N):
    judge = False
    if str(i).find("3") > -1 and str(i).find("5") > -1 and str(i).find("7") > -1:
        judge = True
    else:
        continue
    if str(i).find("0") > -1:
        continue
    if str(i).find("1") > -1:
        continue
    if str(i).find("2") > -1:
        continue
    if str(i).find("4") > -1:
        continue
    if str(i).find("6") > -1:
        continue
    if str(i).find("8") > -1:
        continue
    if str(i).find("9") > -1:
        continue
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = int(0)
for i in range(0, N):
    judge = False
    if str(i).find("3") > -1 and str(i).find("5") > -1 and str(i).find("7") > -1:
        judge = True
    if str(i).find("0") > -1:
        judge = False
    if str(i).find("1") > -1:
        judge = False
    if str(i).find("2") > -1:
        judge = False
    if str(i).find("4") > -1:
        judge = False
    if str(i).find("6") > -1:
        judge = False
    if str(i).find("8") > -1:
        judge = False
    if str(i).find("9") > -1:
        judge = False
    if judge == True:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
count = int(0)
for i in range(0, N):
    judge = False
    if str(i).find("357") > -1 or str(i).find("375") > -1 or str(i).find("537") > -1 or str(i).find("573") > -1 or str(i).find("735")  > -1 or str(i).find("753") > -1:
        judge = True
    if str(i).find("0") > -1:
        judge = False
    if str(i).find("1") > -1:
        judge = False
    if str(i).find("2") > -1:
        judge = False
    if str(i).find("4") > -1:
        judge = False
    if str(i).find("6") > -1:
        judge = False
    if str(i).find("8") > -1:
        judge = False
    if str(i).find("9") > -1:
        judge = False
    if judge == True:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = 999
count = int(0)
for i in range(333, N):
    judge = False
    if str(i).find("357") > -1 or str(i).find("375") > -1 or str(i).find("537") > -1 or str(i).find("573") > -1 or str(i).find("735")  > -1 or str(i).find("753") > -1:
        judge = True
    if str(i).find("0") > -1:
        judge = False
    if str(i).find("1") > -1:
        judge = False
    if str(i).find("2") > -1:
        judge = False
    if str(i).find("4") > -1:
        judge = False
    if str(i).find("6") > -1:
        judge = False
    if str(i).find("8") > -1:
        judge = False
    if str(i).find("9") > -1:
        judge = False
    if judge == True:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = 9999
count = int(0)
for i in range(333, N):
    judge = False
    if str(i).find("357") > -1 or str(i).find("537") > -1 or str(i).find("375") > -1 or str(i).find("573") -1 > -1 or str(i).find("753")  > -1 or str(i).find("735") > -1:
        judge = True
    if str(i).find("0") > -1:
        judge = False
    if str(i).find("1") > -1:
        judge = False
    if str(i).find("2") > -1:
        judge = False
    if str(i).find("4") > -1:
        judge = False
    if str(i).find("6") > -1:
        judge = False
    if str(i).find("8") > -1:
        judge = False
    if str(i).find("9") > -1:
        judge = False
    if judge == True:
        count += 1
print(count)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([1,1,1,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2
]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if int(N[i])==3:
        check3 = True
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])<5:
        break
    if int(N[i])==5:
        check5 = True
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])<7:
        break
    if int(N[i])==7:
        check7 = True
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    break
else:
    if check3 and check5 and check7:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([0,0,0,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2
]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if int(N[i])==3:
        check3 = True
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])<5:
        break
    if int(N[i])==5:
        check5 = True
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])<7:
        break
    if int(N[i])==7:
        check7 = True
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    break
else:
    if check3 and check5 and check7:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([0,0,0,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])==3:
        check3 = True
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if int(N[i])<5:
        break
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])==5:
        check5 = True
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if int(N[i])<7:
        break
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    if int(N[i])==7:
        check7 = True
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    break

print(ans)

Submission status: Wrong Answer

Solution code:
num753 = []
num753.append([0,0,0,0,0,0,0])  #3,5,7,35,37,57,357
num753.append([1,1,1,0,0,0,0])

for i in range(1,10):
    num753.append([num753[i][0],num753[i][1],num753[i][2],num753[i][0]+num753[i][1]+num753[i][3]*2,num753[i][0]+num753[i][2]+num753[i][4]*2,num753[i][1]+num753[i][2
]+num753[i][5]*2,num753[i][3]+num753[i][4]+num753[i][5]+num753[i][6]*3])

N = input()

ans = 0
for i in range(len(N)):
    ans += num753[i][6]

check3 = False
check5 = False
check7 = False
for i in range(len(N)):
    if int(N[i])<3:
        break
    if int(N[i])==3:
        check3 = True
        continue
    ans += num753[len(N)-i-1][5]+num753[len(N)-i-1][6]
    if check5:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][4]
    if check7:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][3]
    if check5 and check7:
        ans += num753[len(N)-i-1][0]
    if int(N[i])<5:
        break
    if int(N[i])==5:
        check5 = True
        continue
    ans += num753[len(N)-i-1][4]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][2]+num753[len(N)-i-1][5]
    if check7:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][3]
    if check3 and check7:
        ans += num753[len(N)-i-1][1]
    if int(N[i])<7:
        break
    if int(N[i])==7:
        check7 = True
        continue
    ans += num753[len(N)-i-1][3]+num753[len(N)-i-1][6]
    if check3:
        ans += num753[len(N)-i-1][1]+num753[len(N)-i-1][5]
    if check5:
        ans += num753[len(N)-i-1][0]+num753[len(N)-i-1][4]
    if check3 and check5:
        ans += num753[len(N)-i-1][2]
    break

print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
n_list=[i for i in range(n)]
cnt=0
for i in range(n):
    if str(n_list[i]).count('3') >= 1:
        if str(n_list[i]).count('5') >= 1:
            if str(n_list[i]).count('7') >= 1:
                if str(n_list[i]).replace('3','').replace('5','').replace('7','') == "":
                    cnt+=1
print(cnt)

Submission status: Wrong Answer

Solution code:
def func(S, num):
    ret = 0
    if '3' in S and '5' in S and '7' in S and int(S) < num:
        ret += 1
    if len(S) == 10:
        return 0
    ret += func(S + '3', num)
    ret += func(S + '5', num)
    ret += func(S + '7', num)
    return ret

print func('', input())

Submission status: Wrong Answer

Solution code:
count=0
n = int(input())
i=1
while i<=n+1:
  str_i = str(i)
  f7=f5=f3=False
  for j in range(0, len(str_i)):
    if "7" == str_i[j]:
      f7=True
    elif "5" == str_i[j]:
      f5=True
    elif "3" == str_i[j]:
      f3=True
    else:
      break

    if j == len(str_i)-1 and f7 and f5 and f3:
      #print( i )
      count = count+1

  i=i+2

print( count )

Submission status: Wrong Answer

Solution code:
# your code goes here
maxN=int(input())
count=0
for a in range(1, int(maxN/2)):
	tempN=a*2+1
	three=five=seven=False
	for b in range(0,len(str(tempN))):
		tempD=int(str(tempN)[b])
		if tempD==3:
			three=True
		elif tempD==5:
			five=True
		elif tempD==7:
			seven=True
		else:
			three=five=seven=False
			break
	if three and five and seven:
		count=count+1
print(count)

Submission status: Wrong Answer

Solution code:
n=int(input(""))

q=0
for i in range(1,n) :
    p=[int(x) for x in list(str(i))]
    if p[0] ==3 or p[0]==5 or p[0] ==7 :
        if 0 not in p and 1 not in p and 2 not in p and 4 not in p and 6 not in p and 8 not in p and 9 not in p :
            if 7 in p and 5 in p and 3 in p:
                q=q+1
            else:
                continue
        else:
            continue
    else:
        continue
print(q)

Submission status: Wrong Answer

Solution code:
N = int(input())
numset = {"3","5","7"}
evaluate = lambda x :set(str(x)) == numset
print(len([str(i) for i in range(357,N) if evaluate(i)]))

Submission status: Wrong Answer

Solution code:
N = int(input())
numset = {"3","5","7"}
evaluate = lambda x :set(str(x)) == numset
print("\n".join([str(i) for i in range(357,N) if evaluate(i)]))

Submission status: Wrong Answer

Solution code:
import re
a = input()
c=0
for i in range(1,int(a),2):
    f=str(i)
    if re.match(r".*[1246890].*" , f):
        continue
    elif not re.match(r".*[357].*" , f):
        continue
    elif not re.match(r".*[3].*" , f):
        continue
    elif not re.match(r".*[5].*" , f):
        continue
    elif not re.match(r".*[7].*" , f):
        continue
    c+=1

print(c)

Submission status: Wrong Answer

Solution code:
import re
a = input()
c=0
for i in range(1,int(a),2):
    f=str(i)
    if re.match(r".*[1246890].*" , f):
        continue
    elif f.find('3') == -1:
        continue
    elif f.find('5') == -1:
        continue
    elif f.find('7') == -1:
        continue
    c+=1

print(c)

Submission status: Wrong Answer

Solution code:
import re
a = input()
c=0
for i in range(356,int(a)):
    f=str(i)
    if re.match(r"[1246890]" , f):
        continue
    elif f.find('3') == -1:
        continue
    elif f.find('5') == -1:
        continue
    elif f.find('7') == -1:
        continue
    c+=1

print(c)

Submission status: Wrong Answer

Solution code:
import re
a = input()
c=0
for i in range(356,int(a)):
    f=str(i)
    if f.find('3') == -1:
        continue
    elif f.find('5') == -1:
        continue
    elif f.find('7') == -1:
        continue
    elif re.match(r"[1246890]" , f):
        c+=1

print(c)