Skip to content

Instantly share code, notes, and snippets.

@nicklegr
Created April 27, 2012 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicklegr/2508543 to your computer and use it in GitHub Desktop.
Save nicklegr/2508543 to your computer and use it in GitHub Desktop.
GCJ ruby template
require 'pp'
# http://0xcc.net/ruby-bsearch/index.html.ja
# require './bsearch'
# https://github.com/kanwei/algorithms
# require 'rubygems'
# require 'algorithms'
# include Containers
def ppd(*arg)
if $DEBUG
pp(*arg)
end
end
def putsd(*arg)
if $DEBUG
puts(*arg)
end
end
def ri
readline.to_i
end
def ris
readline.split.map do |e| e.to_i end
end
def rs
readline.chomp
end
def rss
readline.chomp.split
end
def rfs
readline.split.map do |e| e.to_f end
end
def rws(count)
words = []
for i in 1 .. count
words << readline.chomp
end
words
end
# main
t_start = Time.now
# ここから問題に応じて
cases = readline().to_i
(1 .. cases).each do |case_index|
# readline().chomp
# readline().split
puts "Case ##{case_index}: #{answer}"
# progress
trigger =
if cases >= 10
case_index % (cases / 10) == 0
else
true
end
if trigger
STDERR.puts("case #{case_index} / #{cases}, time: #{Time.now - t_start} s")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment