Submission #4169
Source Code Expand
class Array def getbord self.map{|x|Array.new(self.size).fill(".").fill(x,1){"Q"}.join} * "\n" end def is_ok? self.each.with_index.to_a.combination(2).to_a.none?{|p,q|(p[0]-q[0]).abs==(p[1]-q[1]).abs} end end begin x = [] break unless 8.times do s = gets.chomp break false if s.count("Q") > 1 x << s.index("Q") end (0...8).to_a.permutation.to_a.select{|a|a.is_ok?}.each do|a| if a.zip(x).all?{|i,j| i == j || j.nil?} puts a.getbord exit end end end while false puts "No Answer"
Submission Info
Submission Time | |
---|---|
Task | C - パズルのお手伝い |
User | MiSawa |
Language | C++ (GCC 4.4.7) |
Score | 0 |
Code Size | 563 Byte |
Status | CE |
Compile Error
./Main.cpp:12: error: invalid suffix "times" on floating constant ./Main.cpp:18: error: too many decimal points in number ./Main.cpp:2: error: expected initializer before ‘getbord’