#!/usr/local/bin/ruby # -*- mode: ruby -*- # $Id: ary3.ruby,v 1.1 2001/05/31 02:27:48 doug Exp $ # http://www.bagley.org/~doug/shootout/ n = Integer(ARGV.shift || 1) i = 0 x = Array.new(n) y = Array.new(n) last = n-1 for i in 0 .. last x[i] = i + 1 y[i] = 0 end for k in 0 .. 999 last.step(0,-1) do |i| y[i] += x[i] end end puts "#{y[0]} #{y[last]}"