Rewrite ZJUerXTopCoder in ruby language