Submission #2912893


Source Code Expand

Copy
c, d = gets.split.map(&:to_i)
a = 140
b = 170

ans = 0
while a <= d
    if a <= c && c <= b && b <= d
        ans += b-c
    elsif c <= a && a <= d && d <= b
        ans += d-a
    elsif a <= c && d <= b
        ans += d-c
    elsif c <= a && b <= d
        ans += b-a
    end
    a *= 2
    b *= 2
end
puts ans

Submission Info

Submission Time
Task A - Feel the Beat
User betrue12
Language Ruby (2.3.3)
Score 300
Code Size 329 Byte
Status
Exec Time 7 ms
Memory 1788 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 a01, a02, a03
All 300 / 300 a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15
Case Name Status Exec Time Memory
a01 7 ms 1788 KB
a02 7 ms 1788 KB
a03 7 ms 1788 KB
b04 7 ms 1788 KB
b05 7 ms 1788 KB
b06 7 ms 1788 KB
b07 7 ms 1788 KB
b08 7 ms 1788 KB
b09 7 ms 1788 KB
b10 7 ms 1788 KB
b11 7 ms 1788 KB
b12 7 ms 1788 KB
b13 7 ms 1788 KB
b14 7 ms 1788 KB
b15 7 ms 1788 KB