Submission #1043077


Source Code Expand

include Math

$fp=open("C:/work/stdin/rubytxt.txt")

def solve(x, y)
	t=0
	p [x,y]
	if x<y
		if x>=0 && y>=0
			t=y-x
		elsif x<0 && y>=0
			y=-y
			t=y-x
			t+=1
		elsif x<0 && y<0
			t=y-x
		end
	elsif x>y
		if x>=0 && y>=0
			t=x-y+2
		elsif x>=0 && y<0
			y=-y
			t=x-y+1
		elsif x<0 && y<0
			x=-x
			y=-y
			t=y-x+2
		end
	elsif x==y
		t=0
	end
	p t
end

if __FILE__==$0
	data=$fp.gets.strip.split(" ").map(&:to_i)
	solve(data[0],data[1])
end

Submission Info

Submission Time
Task A - Simple Calculator
User tokumei_jp
Language Ruby (2.3.3)
Score 0
Code Size 485 Byte
Status RE
Exec Time 11 ms
Memory 1788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
RE × 3
RE × 14
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt
Case Name Status Exec Time Memory
0_00.txt RE 10 ms 1788 KB
0_01.txt RE 11 ms 1788 KB
0_02.txt RE 10 ms 1788 KB
1_00.txt RE 10 ms 1788 KB
1_01.txt RE 10 ms 1788 KB
1_02.txt RE 11 ms 1788 KB
1_03.txt RE 11 ms 1788 KB
1_04.txt RE 11 ms 1788 KB
1_05.txt RE 10 ms 1788 KB
1_06.txt RE 10 ms 1788 KB
1_07.txt RE 10 ms 1788 KB
1_08.txt RE 10 ms 1788 KB
1_09.txt RE 10 ms 1788 KB
1_10.txt RE 11 ms 1788 KB