fork download
  1. puts Rational(123125010100101102032105110116040115116114044102109116061034037115034041010098101103105110010115116114061115116114046100117112010115116114046103115117098033040039094039044039042042039041010115116114046103115117098033040047040097099111115104124097115105110104124097116097110104124097116097110050124097116097110124097115105110124097099111115124099111115104124115105110104124116097110104124115105110124099111115124116097110124115113114116124108111103049048124108111103050124103097109109097124108111103124101120112124101114102099124101114102124104121112111116041047105041123034077097116104046035123036049046100111119110099097115101125034125010115116114046103115117098033040047040101040036124091094114120093041124112105041047105041123034077097116104058058035123036049046117112099097115101125034125010101118097108040102109116037115116114041010114101115099117101032069120099101112116105111110061062101010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010101110100010119061105110116040065082071086046115104105102116041046116111095105010104061105110116040065082071086046115104105102116041046116111095105010098061105110116040065082071086046115104105102116041046116111095102010101061105110116040065082071086046115104105102116041046116111095102010102061105110116040065082071086046106111105110040039032039041044034045062120123037115125034041010119105110061065114114097121046110101119040104041123065114114097121046110101119040119041123039032039125125010100120061040101045098041047119046116111095102010098101103105110010121061065114114097121046110101119040119041123124120124102091098043040120043048046053041042100120093125010114101115099117101032069120099101112116105111110010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010114044113061121046109105110109097120010114061048032105102032114062048010113061048032105102032113060048010114045061048046048048049032105102032114061061113010121046109097112033032100111032124122124032010112121061040040122045114041042104047040113045114041046116111095102045048046053041046114111117110100010112121061048032105102032112121032060032048010112121061104045049032105102032112121062061104010112121010101110100010121048061040045114042104047040113045114041046116111095102045048046053041046114111117110100010121048061048032105102032121048060048010121048061104045049032105102032121048062061104010100121061040113045114041047104046116111095102010119046116105109101115032100111032124120124010121049044121050061091121048044121091120093093046109105110109097120010040121049046046121050041046101097099104123124122124119105110091122093091120093061063035125010119105110091121048093091120093061063045010101110100010112117116115032119105110046114101118101114115101046109097112040038058106111105110041046106111105110040034010034041010,123125010100101102032105110116040115116114044102109116061034037115034041010098101103105110010115116114061115116114046100117112010115116114046103115117098033040039094039044039042042039041010115116114046103115117098033040047040097099111115104124097115105110104124097116097110104124097116097110050124097116097110124097115105110124097099111115124099111115104124115105110104124116097110104124115105110124099111115124116097110124115113114116124108111103049048124108111103050124103097109109097124108111103124101120112124101114102099124101114102124104121112111116041047105041123034077097116104046035123036049046100111119110099097115101125034125010115116114046103115117098033040047040101040036124091094114120093041124112105041047105041123034077097116104058058035123036049046117112099097115101125034125010101118097108040102109116037115116114041010114101115099117101032069120099101112116105111110061062101010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010101110100010119061105110116040065082071086046115104105102116041046116111095105010104061105110116040065082071086046115104105102116041046116111095105010098061105110116040065082071086046115104105102116041046116111095102010101061105110116040065082071086046115104105102116041046116111095102010102061105110116040065082071086046106111105110040039032039041044034045062120123037115125034041010119105110061065114114097121046110101119040104041123065114114097121046110101119040119041123039032039125125010100120061040101045098041047119046116111095102010098101103105110010121061065114114097121046110101119040119041123124120124102091098043040120043048046053041042100120093125010114101115099117101032069120099101112116105111110010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010114044113061121046109105110109097120010114061048032105102032114062048010113061048032105102032113060048010114045061048046048048049032105102032114061061113010121046109097112033032100111032124122124032010112121061040040122045114041042104047040113045114041046116111095102045048046053041046114111117110100010112121061048032105102032112121032060032048010112121061104045049032105102032112121062061104010112121010101110100010121048061040045114042104047040113045114041046116111095102045048046053041046114111117110100010121048061048032105102032121048060048010121048061104045049032105102032121048062061104010100121061040113045114041047104046116111095102010119046116105109101115032100111032124120124010121049044121050061091121048044121091120093093046109105110109097120010040121049046046121050041046101097099104123124122124119105110091122093091120093061063035125010119105110091121048093091120093061063045010101110100010112117116115032119105110046114101118101114115101046109097112040038058106111105110041046106111105110040034010034041011).numerator.to_s.chars.each_slice(3).map{|x|x.join.to_i.chr}.join
Success #stdin #stdout 0.02s 7564KB
stdin
Standard input is empty
stdout
{}
def int(str,fmt="%s")
begin
str=str.dup
str.gsub!('^','**')
str.gsub!(/(acosh|asinh|atanh|atan2|atan|asin|acos|cosh|sinh|tanh|sin|cos|tan|sqrt|log10|log2|gamma|log|exp|erfc|erf|hypot)/i){"Math.#{$1.downcase}"}
str.gsub!(/(e($|[^rx])|pi)/i){"Math::#{$1.upcase}"}
eval(fmt%str)
rescue Exception=>e
puts "invalid input"
exit 1
end
end
w=int(ARGV.shift).to_i
h=int(ARGV.shift).to_i
b=int(ARGV.shift).to_f
e=int(ARGV.shift).to_f
f=int(ARGV.join(' '),"->x{%s}")
win=Array.new(h){Array.new(w){' '}}
dx=(e-b)/w.to_f
begin
y=Array.new(w){|x|f[b+(x+0.5)*dx]}
rescue Exception
puts "invalid input"
exit 1
end
r,q=y.minmax
r=0 if r>0
q=0 if q<0
r-=0.001 if r==q
y.map! do |z| 
py=((z-r)*h/(q-r).to_f-0.5).round
py=0 if py < 0
py=h-1 if py>=h
py
end
y0=(-r*h/(q-r).to_f-0.5).round
y0=0 if y0<0
y0=h-1 if y0>=h
dy=(q-r)/h.to_f
w.times do |x|
y1,y2=[y0,y[x]].minmax
(y1..y2).each{|z|win[z][x]=?#}
win[y0][x]=?-
end
puts win.reverse.map(&:join).join("
")