Submission #169379


Source Code Expand

Copy
def fact(n)
  if n == 0
    1
  else
    n * fact(n-1)
  end
end
n = gets.to_i
de = (fact n).to_f
a = Array.new
(1..n).each {|i|
	c = gets.chomp.to_i
	a << c
	n = n-1
}
a.reverse!
ccc = 0
a.permutation.each {|aa|
	cable = Array.new
	aa.each_index {|i|
		c = 0
		(i+1..aa.length).each { |j|
			f = aa[i].to_i
			l = aa[j].to_i
			if (l != 0) && (f % l == 0)
				c = c + 1 
			end
		}
		if (c == 0) || (c % 2 == 0)
			cable << aa[i]
		end
	}
	ccc = ccc + cable.length
}
print (ccc / de)

Submission Info

Submission Time
Task C - コイン
User pneu
Language Ruby (1.9.3)
Score 0
Code Size 520 Byte
Status WA
Exec Time 2034 ms
Memory 4468 KB

Compile Error

./Main.rb:35: warning: (...) interpreted as grouped expression

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 0 / 99 0 / 1
Status
WA × 3
WA × 20
WA × 20
TLE × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Subtask2 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_20.txt
Case Name Status Exec Time Memory
sample_01.txt WA 58 ms 4208 KB
sample_02.txt WA 59 ms 4212 KB
sample_03.txt WA 56 ms 4212 KB
subtask1_01.txt WA 55 ms 4204 KB
subtask1_02.txt WA 61 ms 4336 KB
subtask1_03.txt WA 55 ms 4212 KB
subtask1_04.txt WA 757 ms 4340 KB
subtask1_05.txt WA 763 ms 4340 KB
subtask1_06.txt WA 133 ms 4340 KB
subtask1_07.txt WA 736 ms 4336 KB
subtask1_08.txt WA 65 ms 4216 KB
subtask1_09.txt WA 59 ms 4212 KB
subtask1_10.txt WA 764 ms 4336 KB
subtask1_11.txt WA 63 ms 4340 KB
subtask1_12.txt WA 752 ms 4316 KB
subtask1_13.txt WA 57 ms 4216 KB
subtask1_14.txt WA 133 ms 4340 KB
subtask1_15.txt WA 786 ms 4340 KB
subtask1_16.txt WA 771 ms 4336 KB
subtask1_17.txt WA 796 ms 4332 KB
subtask1_18.txt WA 793 ms 4340 KB
subtask1_19.txt WA 777 ms 4336 KB
subtask1_20.txt WA 787 ms 4336 KB
subtask2_01.txt TLE 2032 ms 4340 KB
subtask2_02.txt TLE 2032 ms 4464 KB
subtask2_03.txt TLE 2033 ms 4432 KB
subtask2_04.txt TLE 2031 ms 4340 KB
subtask2_05.txt TLE 2031 ms 4336 KB
subtask2_06.txt TLE 2033 ms 4452 KB
subtask2_07.txt TLE 2033 ms 4464 KB
subtask2_08.txt TLE 2031 ms 4464 KB
subtask2_09.txt TLE 2031 ms 4468 KB
subtask2_10.txt TLE 2032 ms 4464 KB
subtask2_11.txt TLE 2031 ms 4464 KB
subtask2_12.txt TLE 2032 ms 4468 KB
subtask2_13.txt TLE 2033 ms 4460 KB
subtask2_14.txt TLE 2032 ms 4452 KB
subtask2_15.txt TLE 2033 ms 4340 KB
subtask2_16.txt TLE 2032 ms 4464 KB
subtask2_17.txt TLE 2031 ms 4440 KB
subtask2_18.txt TLE 2034 ms 4464 KB
subtask2_19.txt TLE 2033 ms 4468 KB
subtask2_20.txt TLE 2032 ms 4340 KB