Submission #3270889


Source Code Expand

(a, b) = gets.chomp.split(' ').map(&:to_i)

def palindromic?(n)
  s = n.to_s
  
  (0..(s.size / 2)).each do |i|
    if s[i] != s[(s.size - 1) - i] then
      return false
    end
  end
  
  return true
end

c = 0

(a..b).each do |n|
  if palindromic?(n) then
    c += 1
  end
end

puts c.to_s

Submission Info

Submission Time
Task B - Palindromic Numbers
User material
Language Ruby (2.3.3)
Score 200
Code Size 314 Byte
Status AC
Exec Time 86 ms
Memory 1788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt AC 86 ms 1788 KB
02.txt AC 83 ms 1788 KB
03.txt AC 84 ms 1788 KB
04.txt AC 47 ms 1788 KB
05.txt AC 38 ms 1788 KB
06.txt AC 31 ms 1788 KB
07.txt AC 85 ms 1788 KB
08.txt AC 7 ms 1788 KB
s1.txt AC 7 ms 1788 KB
s2.txt AC 62 ms 1788 KB