Submission #236434


Source Code Expand

def is_uru?(year)
  if year % 4 == 0
    if year % 100 == 0
      if year % 400 == 0
        return true
      end
      return false
    end
    return true
  end
  return false
end

a, b = gets.strip.chomp.split(' ').map{|i| i.to_i}

ad = (a / 400 + 1) * 400

bd = (b / 400) * 400

unko = ((bd - ad) / 400) * 97

cnt = 0

a.upto(ad - 1) do |y|
  cnt += 1 if is_uru?(y)
end

bd.upto(b) do |y|
  cnt += 1 if is_uru?(y)
end

puts cnt + unko

Submission Info

Submission Time
Task C - 2月29日
User yantene
Language Ruby (1.9.3)
Score 100
Code Size 470 Byte
Status AC
Exec Time 37 ms
Memory 2508 KB

Judge Result

Set Name sub All
Score / Max Score 25 / 25 75 / 75
Status
AC × 10
AC × 19
Set Name Test Cases
sub test_01A.txt, test_02A.txt, test_03A.txt, test_04A.txt, test_05A.txt, test_07A.txt, test_09A.txt, test_11A.txt, test_13A.txt, test_15A.txt
All test_01A.txt, test_02A.txt, test_03A.txt, test_04A.txt, test_05A.txt, test_06.txt, test_07A.txt, test_08.txt, test_09A.txt, test_10.txt, test_11A.txt, test_12.txt, test_13A.txt, test_14.txt, test_15A.txt, test_16.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 35 ms 2340 KB
sample_02.txt AC 37 ms 2344 KB
sample_03.txt AC 35 ms 2340 KB
test_01A.txt AC 34 ms 2460 KB
test_02A.txt AC 34 ms 2460 KB
test_03A.txt AC 36 ms 2332 KB
test_04A.txt AC 37 ms 2336 KB
test_05A.txt AC 36 ms 2340 KB
test_06.txt AC 36 ms 2332 KB
test_07A.txt AC 36 ms 2340 KB
test_08.txt AC 35 ms 2340 KB
test_09A.txt AC 36 ms 2508 KB
test_10.txt AC 36 ms 2336 KB
test_11A.txt AC 36 ms 2336 KB
test_12.txt AC 36 ms 2336 KB
test_13A.txt AC 36 ms 2340 KB
test_14.txt AC 36 ms 2464 KB
test_15A.txt AC 36 ms 2340 KB
test_16.txt AC 36 ms 2336 KB