Submission #3703280


Source Code Expand

#
# File    : C.rb
# Author  : Kazune Takahashi
# Created : 2018-12-2 21:03:42
# Powered by Visual Studio Code
#

n = gets.to_i

ary = Array.new(11){[]}
ary[0] = ['7', '5', '3']

10.times{|t|
  ary[t].each{|x|
    ary[t+1] << x + '7'
    ary[t+1] << x + '5'
    ary[t+1] << x + '3'
  }
}

ans = []
11.times{|t|
  ans.concat(ary[t])
}

res = 0

ans.each{|str|
  if !(str.include?('3') && str.include?('5') && str.include?('7'))
    next
  end
  if str.to_i <= n
    res += 1
  end
}

puts res

Submission Info

Submission Time
Task C - 755
User kazunetakahashi
Language Ruby (2.3.3)
Score 300
Code Size 527 Byte
Status AC
Exec Time 225 ms
Memory 28412 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20
Case Name Status Exec Time Memory
a01 AC 223 ms 28412 KB
a02 AC 222 ms 28412 KB
a03 AC 222 ms 28412 KB
b04 AC 223 ms 28412 KB
b05 AC 222 ms 28412 KB
b06 AC 222 ms 28412 KB
b07 AC 223 ms 28412 KB
b08 AC 221 ms 28412 KB
b09 AC 225 ms 28412 KB
b10 AC 221 ms 28412 KB
b11 AC 222 ms 28412 KB
b12 AC 224 ms 28412 KB
b13 AC 224 ms 28412 KB
b14 AC 223 ms 28412 KB
b15 AC 225 ms 28412 KB
b16 AC 224 ms 28412 KB
b17 AC 224 ms 28412 KB
b18 AC 223 ms 28412 KB
b19 AC 224 ms 28412 KB
b20 AC 223 ms 28412 KB