Submission #1955875


Source Code Expand

a = gets.split(" ").map(&:to_i)

for i in 0..a.length do
    a[i]=a[i].to_i
end
x=0
y=0
z=0
for i in 1..a[0] do
    if a[1]>=10000 then
        a[1]-=10000
        x+=1
    elsif a[1]>=5000
        a[1]-=5000
        y+=1
    elsif a[1]>=1000
        a[1]-=1000
        z+=1
    end
end
if a[1]>0 then
    x=-1
    y=-1
    z=-1
end
temp=a[0]-(x+y+z)
while temp!=0
    if temp>0 then
        if temp>=4 then
            if y>0 then
                y-=1
                z+=5
                temp-=4
            elsif x>0 then
                x-=1
                y+=2
                temp-=1
            else 
                x=-1
                y=-1
                z=-1
                break
            end
        elsif x>0 then
            x-=1
            y+=2
            temp-=1
        else 
            x=-1
            y=-1
            z=-1
            break
        end
    else 
        x=-1
        y=-1
        z=-1
        break
    end
end
puts ("#{x} #{y} #{z}")

Submission Info

Submission Time
Task C - Otoshidama
User wakuwinmail
Language Ruby (2.3.3)
Score 300
Code Size 1040 Byte
Status AC
Exec Time 8 ms
Memory 1788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 24
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 7 ms 1788 KB
a02 AC 7 ms 1788 KB
a03 AC 7 ms 1788 KB
a04 AC 8 ms 1788 KB
b05 AC 7 ms 1788 KB
b06 AC 7 ms 1788 KB
b07 AC 7 ms 1788 KB
b08 AC 8 ms 1788 KB
b09 AC 8 ms 1788 KB
b10 AC 8 ms 1788 KB
b11 AC 8 ms 1788 KB
b12 AC 8 ms 1788 KB
b13 AC 8 ms 1788 KB
b14 AC 8 ms 1788 KB
b15 AC 8 ms 1788 KB
b16 AC 8 ms 1788 KB
b17 AC 8 ms 1788 KB
b18 AC 7 ms 1788 KB
b19 AC 7 ms 1788 KB
b20 AC 8 ms 1788 KB
b21 AC 8 ms 1788 KB
b22 AC 8 ms 1788 KB
b23 AC 8 ms 1788 KB
b24 AC 8 ms 1788 KB