CODE FESTIVAL 2014 予選A

Submission #236434

Source codeソースコード

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

Task問題 C - 2月29日
User nameユーザ名 yantene
Created time投稿日時
Language言語 Ruby (1.9.3)
Status状態 AC
Score得点 100
Source lengthソースコード長 470 Byte
File nameファイル名
Exec time実行時間 37 ms
Memory usageメモリ使用量 2508 KB

Test case

Set

Set name Score得点 / Max score Cases
sub 25 / 25 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 75 / 75 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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