2012年11月19日月曜日

開発環境

『初めてのプログラミング 第2版』(Chris Pine 著、長尾 高弘 訳、オライリー・ジャパン、2010年、ISBN978-4-87311-469-9)の 10章(章全部で復習), 10.5(練習問題の続き)「壁にビールが99本」 を解いてみる。

その他参考書籍

「壁にビールが99本」

コード(TextWrangler)

sample.rb

#!/usr/bin/env ruby1.9
# -*- coding: utf-8 -*-

def english_number number
  num_string = ""
  ones_place = %w[one two three
                four five six
                seven eight nine]
  tens_place = %w[ten twenty thirty
                  forty fifty sixty
                  seventy eighty ninety]
  teenagers = %w[eleven tweleve thirteen
                 fourteen fifteen sixteen
                 seventeen eighteen nineteen]
  others = [[2,  'hundred'],
            [3,  'thousand'],
            [6,  'million'],
            [9,  'billion'],
            [12,  'trillion']]
  left = number
  while others.length > 0
    other = others.pop
    write = left / (10 ** other[0])
    left -= write * (10 ** other[0])
    if write > 0
      pre = english_number write
      num_string = num_string + pre + ' ' + other[1]
      if left > 0
        num_string += ' '
      end
    end
  end
  write = left / 10
  left = left - write * 10
  if write > 0
    if (write == 1) and (left > 0)
      num_string += teenagers[left - 1]
      left = 0
    else
      num_string += tens_place[write - 1]
    end
    num_string += '-' if left > 0
  end
  write = left
  left = 0
  num_string += ones_place[write - 1] if write > 0
  num_string
end

n = 100
while true
  puts "#{english_number n} bottles of beer on the wall, #{english_number n} bottles of beer!"
  n -= 1
  break if n == 1
  puts "Take one down, pass it around, #{english_number n} bottles of beer on the wall!"
end
puts "Take one down, pass it around, #{english_number n} bottle of beer on the wall!"
puts "#{english_number n} bottle of beer on the wall, #{english_number n} bottle of beer!"
puts "Take one down, pass it around, no more bottles of beer on the wall!"

# メモ化バージョンを作成して速度比較
@english_numbers = {}
def english_number1 number
  return @english_numbers[number] if @english_numbers[number]
  num_string = ""
  ones_place = %w[one two three
                four five six
                seven eight nine]
  tens_place = %w[ten twenty thirty
                  forty fifty sixty
                  seventy eighty ninety]
  teenagers = %w[eleven tweleve thirteen
                 fourteen fifteen sixteen
                 seventeen eighteen nineteen]
  others = [[2,  'hundred'],
            [3,  'thousand'],
            [6,  'million'],
            [9,  'billion'],
            [12,  'trillion']]
  left = number
  while others.length > 0
    other = others.pop
    write = left / (10 ** other[0])
    left -= write * (10 ** other[0])
    if write > 0
      pre = english_number1 write
      num_string = num_string + pre + ' ' + other[1]
      if left > 0
        num_string += ' '
      end
    end
  end
  write = left / 10
  left = left - write * 10
  if write > 0
    if (write == 1) and (left > 0)
      num_string += teenagers[left - 1]
      left = 0
    else
      num_string += tens_place[write - 1]
    end
    num_string += '-' if left > 0
  end
  write = left
  left = 0
  num_string += ones_place[write - 1] if write > 0
  @english_numbers[number] = num_string
  num_string
end

def profile description, &block
  start = Time.new
  block.call
  puts "#{description}: #{Time.new - start}秒"
end

n = 100000
profile 'メモ化無し' do
  (1..n).each do |number|
    english_number number
  end
end
profile 'メモ化有り' do
  (1..n).each do |number|
    english_number1 number
  end
end

入出力結果(Terminal)

$ ./sample.rb
one hundred bottles of beer on the wall, one hundred bottles of beer!
Take one down, pass it around, ninety-nine bottles of beer on the wall!
ninety-nine bottles of beer on the wall, ninety-nine bottles of beer!
Take one down, pass it around, ninety-eight bottles of beer on the wall!
ninety-eight bottles of beer on the wall, ninety-eight bottles of beer!
Take one down, pass it around, ninety-seven bottles of beer on the wall!
ninety-seven bottles of beer on the wall, ninety-seven bottles of beer!
Take one down, pass it around, ninety-six bottles of beer on the wall!
ninety-six bottles of beer on the wall, ninety-six bottles of beer!
Take one down, pass it around, ninety-five bottles of beer on the wall!
ninety-five bottles of beer on the wall, ninety-five bottles of beer!
Take one down, pass it around, ninety-four bottles of beer on the wall!
ninety-four bottles of beer on the wall, ninety-four bottles of beer!
Take one down, pass it around, ninety-three bottles of beer on the wall!
ninety-three bottles of beer on the wall, ninety-three bottles of beer!
Take one down, pass it around, ninety-two bottles of beer on the wall!
ninety-two bottles of beer on the wall, ninety-two bottles of beer!
Take one down, pass it around, ninety-one bottles of beer on the wall!
ninety-one bottles of beer on the wall, ninety-one bottles of beer!
Take one down, pass it around, ninety bottles of beer on the wall!
ninety bottles of beer on the wall, ninety bottles of beer!
Take one down, pass it around, eighty-nine bottles of beer on the wall!
eighty-nine bottles of beer on the wall, eighty-nine bottles of beer!
Take one down, pass it around, eighty-eight bottles of beer on the wall!
eighty-eight bottles of beer on the wall, eighty-eight bottles of beer!
Take one down, pass it around, eighty-seven bottles of beer on the wall!
eighty-seven bottles of beer on the wall, eighty-seven bottles of beer!
Take one down, pass it around, eighty-six bottles of beer on the wall!
eighty-six bottles of beer on the wall, eighty-six bottles of beer!
Take one down, pass it around, eighty-five bottles of beer on the wall!
eighty-five bottles of beer on the wall, eighty-five bottles of beer!
Take one down, pass it around, eighty-four bottles of beer on the wall!
eighty-four bottles of beer on the wall, eighty-four bottles of beer!
Take one down, pass it around, eighty-three bottles of beer on the wall!
eighty-three bottles of beer on the wall, eighty-three bottles of beer!
Take one down, pass it around, eighty-two bottles of beer on the wall!
eighty-two bottles of beer on the wall, eighty-two bottles of beer!
Take one down, pass it around, eighty-one bottles of beer on the wall!
eighty-one bottles of beer on the wall, eighty-one bottles of beer!
Take one down, pass it around, eighty bottles of beer on the wall!
eighty bottles of beer on the wall, eighty bottles of beer!
Take one down, pass it around, seventy-nine bottles of beer on the wall!
seventy-nine bottles of beer on the wall, seventy-nine bottles of beer!
Take one down, pass it around, seventy-eight bottles of beer on the wall!
seventy-eight bottles of beer on the wall, seventy-eight bottles of beer!
Take one down, pass it around, seventy-seven bottles of beer on the wall!
seventy-seven bottles of beer on the wall, seventy-seven bottles of beer!
Take one down, pass it around, seventy-six bottles of beer on the wall!
seventy-six bottles of beer on the wall, seventy-six bottles of beer!
Take one down, pass it around, seventy-five bottles of beer on the wall!
seventy-five bottles of beer on the wall, seventy-five bottles of beer!
Take one down, pass it around, seventy-four bottles of beer on the wall!
seventy-four bottles of beer on the wall, seventy-four bottles of beer!
Take one down, pass it around, seventy-three bottles of beer on the wall!
seventy-three bottles of beer on the wall, seventy-three bottles of beer!
Take one down, pass it around, seventy-two bottles of beer on the wall!
seventy-two bottles of beer on the wall, seventy-two bottles of beer!
Take one down, pass it around, seventy-one bottles of beer on the wall!
seventy-one bottles of beer on the wall, seventy-one bottles of beer!
Take one down, pass it around, seventy bottles of beer on the wall!
seventy bottles of beer on the wall, seventy bottles of beer!
Take one down, pass it around, sixty-nine bottles of beer on the wall!
sixty-nine bottles of beer on the wall, sixty-nine bottles of beer!
Take one down, pass it around, sixty-eight bottles of beer on the wall!
sixty-eight bottles of beer on the wall, sixty-eight bottles of beer!
Take one down, pass it around, sixty-seven bottles of beer on the wall!
sixty-seven bottles of beer on the wall, sixty-seven bottles of beer!
Take one down, pass it around, sixty-six bottles of beer on the wall!
sixty-six bottles of beer on the wall, sixty-six bottles of beer!
Take one down, pass it around, sixty-five bottles of beer on the wall!
sixty-five bottles of beer on the wall, sixty-five bottles of beer!
Take one down, pass it around, sixty-four bottles of beer on the wall!
sixty-four bottles of beer on the wall, sixty-four bottles of beer!
Take one down, pass it around, sixty-three bottles of beer on the wall!
sixty-three bottles of beer on the wall, sixty-three bottles of beer!
Take one down, pass it around, sixty-two bottles of beer on the wall!
sixty-two bottles of beer on the wall, sixty-two bottles of beer!
Take one down, pass it around, sixty-one bottles of beer on the wall!
sixty-one bottles of beer on the wall, sixty-one bottles of beer!
Take one down, pass it around, sixty bottles of beer on the wall!
sixty bottles of beer on the wall, sixty bottles of beer!
Take one down, pass it around, fifty-nine bottles of beer on the wall!
fifty-nine bottles of beer on the wall, fifty-nine bottles of beer!
Take one down, pass it around, fifty-eight bottles of beer on the wall!
fifty-eight bottles of beer on the wall, fifty-eight bottles of beer!
Take one down, pass it around, fifty-seven bottles of beer on the wall!
fifty-seven bottles of beer on the wall, fifty-seven bottles of beer!
Take one down, pass it around, fifty-six bottles of beer on the wall!
fifty-six bottles of beer on the wall, fifty-six bottles of beer!
Take one down, pass it around, fifty-five bottles of beer on the wall!
fifty-five bottles of beer on the wall, fifty-five bottles of beer!
Take one down, pass it around, fifty-four bottles of beer on the wall!
fifty-four bottles of beer on the wall, fifty-four bottles of beer!
Take one down, pass it around, fifty-three bottles of beer on the wall!
fifty-three bottles of beer on the wall, fifty-three bottles of beer!
Take one down, pass it around, fifty-two bottles of beer on the wall!
fifty-two bottles of beer on the wall, fifty-two bottles of beer!
Take one down, pass it around, fifty-one bottles of beer on the wall!
fifty-one bottles of beer on the wall, fifty-one bottles of beer!
Take one down, pass it around, fifty bottles of beer on the wall!
fifty bottles of beer on the wall, fifty bottles of beer!
Take one down, pass it around, forty-nine bottles of beer on the wall!
forty-nine bottles of beer on the wall, forty-nine bottles of beer!
Take one down, pass it around, forty-eight bottles of beer on the wall!
forty-eight bottles of beer on the wall, forty-eight bottles of beer!
Take one down, pass it around, forty-seven bottles of beer on the wall!
forty-seven bottles of beer on the wall, forty-seven bottles of beer!
Take one down, pass it around, forty-six bottles of beer on the wall!
forty-six bottles of beer on the wall, forty-six bottles of beer!
Take one down, pass it around, forty-five bottles of beer on the wall!
forty-five bottles of beer on the wall, forty-five bottles of beer!
Take one down, pass it around, forty-four bottles of beer on the wall!
forty-four bottles of beer on the wall, forty-four bottles of beer!
Take one down, pass it around, forty-three bottles of beer on the wall!
forty-three bottles of beer on the wall, forty-three bottles of beer!
Take one down, pass it around, forty-two bottles of beer on the wall!
forty-two bottles of beer on the wall, forty-two bottles of beer!
Take one down, pass it around, forty-one bottles of beer on the wall!
forty-one bottles of beer on the wall, forty-one bottles of beer!
Take one down, pass it around, forty bottles of beer on the wall!
forty bottles of beer on the wall, forty bottles of beer!
Take one down, pass it around, thirty-nine bottles of beer on the wall!
thirty-nine bottles of beer on the wall, thirty-nine bottles of beer!
Take one down, pass it around, thirty-eight bottles of beer on the wall!
thirty-eight bottles of beer on the wall, thirty-eight bottles of beer!
Take one down, pass it around, thirty-seven bottles of beer on the wall!
thirty-seven bottles of beer on the wall, thirty-seven bottles of beer!
Take one down, pass it around, thirty-six bottles of beer on the wall!
thirty-six bottles of beer on the wall, thirty-six bottles of beer!
Take one down, pass it around, thirty-five bottles of beer on the wall!
thirty-five bottles of beer on the wall, thirty-five bottles of beer!
Take one down, pass it around, thirty-four bottles of beer on the wall!
thirty-four bottles of beer on the wall, thirty-four bottles of beer!
Take one down, pass it around, thirty-three bottles of beer on the wall!
thirty-three bottles of beer on the wall, thirty-three bottles of beer!
Take one down, pass it around, thirty-two bottles of beer on the wall!
thirty-two bottles of beer on the wall, thirty-two bottles of beer!
Take one down, pass it around, thirty-one bottles of beer on the wall!
thirty-one bottles of beer on the wall, thirty-one bottles of beer!
Take one down, pass it around, thirty bottles of beer on the wall!
thirty bottles of beer on the wall, thirty bottles of beer!
Take one down, pass it around, twenty-nine bottles of beer on the wall!
twenty-nine bottles of beer on the wall, twenty-nine bottles of beer!
Take one down, pass it around, twenty-eight bottles of beer on the wall!
twenty-eight bottles of beer on the wall, twenty-eight bottles of beer!
Take one down, pass it around, twenty-seven bottles of beer on the wall!
twenty-seven bottles of beer on the wall, twenty-seven bottles of beer!
Take one down, pass it around, twenty-six bottles of beer on the wall!
twenty-six bottles of beer on the wall, twenty-six bottles of beer!
Take one down, pass it around, twenty-five bottles of beer on the wall!
twenty-five bottles of beer on the wall, twenty-five bottles of beer!
Take one down, pass it around, twenty-four bottles of beer on the wall!
twenty-four bottles of beer on the wall, twenty-four bottles of beer!
Take one down, pass it around, twenty-three bottles of beer on the wall!
twenty-three bottles of beer on the wall, twenty-three bottles of beer!
Take one down, pass it around, twenty-two bottles of beer on the wall!
twenty-two bottles of beer on the wall, twenty-two bottles of beer!
Take one down, pass it around, twenty-one bottles of beer on the wall!
twenty-one bottles of beer on the wall, twenty-one bottles of beer!
Take one down, pass it around, twenty bottles of beer on the wall!
twenty bottles of beer on the wall, twenty bottles of beer!
Take one down, pass it around, nineteen bottles of beer on the wall!
nineteen bottles of beer on the wall, nineteen bottles of beer!
Take one down, pass it around, eighteen bottles of beer on the wall!
eighteen bottles of beer on the wall, eighteen bottles of beer!
Take one down, pass it around, seventeen bottles of beer on the wall!
seventeen bottles of beer on the wall, seventeen bottles of beer!
Take one down, pass it around, sixteen bottles of beer on the wall!
sixteen bottles of beer on the wall, sixteen bottles of beer!
Take one down, pass it around, fifteen bottles of beer on the wall!
fifteen bottles of beer on the wall, fifteen bottles of beer!
Take one down, pass it around, fourteen bottles of beer on the wall!
fourteen bottles of beer on the wall, fourteen bottles of beer!
Take one down, pass it around, thirteen bottles of beer on the wall!
thirteen bottles of beer on the wall, thirteen bottles of beer!
Take one down, pass it around, tweleve bottles of beer on the wall!
tweleve bottles of beer on the wall, tweleve bottles of beer!
Take one down, pass it around, eleven bottles of beer on the wall!
eleven bottles of beer on the wall, eleven bottles of beer!
Take one down, pass it around, ten bottles of beer on the wall!
ten bottles of beer on the wall, ten bottles of beer!
Take one down, pass it around, nine bottles of beer on the wall!
nine bottles of beer on the wall, nine bottles of beer!
Take one down, pass it around, eight bottles of beer on the wall!
eight bottles of beer on the wall, eight bottles of beer!
Take one down, pass it around, seven bottles of beer on the wall!
seven bottles of beer on the wall, seven bottles of beer!
Take one down, pass it around, six bottles of beer on the wall!
six bottles of beer on the wall, six bottles of beer!
Take one down, pass it around, five bottles of beer on the wall!
five bottles of beer on the wall, five bottles of beer!
Take one down, pass it around, four bottles of beer on the wall!
four bottles of beer on the wall, four bottles of beer!
Take one down, pass it around, three bottles of beer on the wall!
three bottles of beer on the wall, three bottles of beer!
Take one down, pass it around, two bottles of beer on the wall!
two bottles of beer on the wall, two bottles of beer!
Take one down, pass it around, one bottle of beer on the wall!
one bottle of beer on the wall, one bottle of beer!
Take one down, pass it around, no more bottles of beer on the wall!
メモ化無し: 3.251002秒
メモ化有り: 2.675983秒
$

入出力結果の先頭に戻る

ちなみにJavaScriptの場合。

コード(TextWrangler)

function english_number(number){
  var num_string = "";
  var ones_place = ['one', 'two', 'three',
                'four', 'five', 'six',
                'seven', 'eight', 'nine'];
  var tens_place = ['ten', 'twenty', 'thirty',
                'forty', 'fifty', 'sixty',
                'seventy', 'eighty', 'ninety'];
  var teenagers = ['eleven', 'twelve', 'thirteen',
                'fourteen', 'fifteen', 'sixteen',
                'seventeen', 'eighteen', 'nineteen'];
  var others = [[2,  'hundred'],
            [3,  'thousand'],
            [6,  'million'],
            [9,  'billion'],
            [12,  'trillion']];
  var left = number;
  while(others.length > 0){
    var other = others.pop();
    var write = Math.floor(left / Math.pow(10, other[0]));
    left = left - write * Math.pow(10, other[0]);
    if(write > 0){
      var pre = english_number(write);
      num_string = num_string + pre + ' ' + other[1];
      if(left > 0){
        num_string += ' ';
      }
    }
  }
  write = Math.floor(left / 10);
  left = left - write * 10;
  if(write > 0){
    if((write == 1) && (left > 0)){
      num_string += teenagers[left - 1];
      left = 0;
    }else{
      num_string += tens_place[write - 1];
    }
    if(left > 0) num_string += '-';
  }
  write = left;
  left = 0;
  if(write > 0) num_string += ones_place[write - 1];
  return num_string;
}

var n = parseInt($('#t0').val());
var result = "";
while(1){
  result += english_number(n) + " bottles of beer on the wall, " + english_number(n) + " bottles of beer!\n";
  n -= 1;
  if(n == 1) break;
  result += "Take one down, pass it around, " + english_number(n) + " bottles of beer on the wall!\n"
}
result += english_number(n) + " bottle of beer on the wall, " + english_number(n) + " bottle of beer!\n" + 
  "Take one down, pass it around, no more bottles of beer on the wall!\n";

// メモ化
var english_numbers = {};
function english_number1(number){
  if(english_numbers[number]) return english_numbers[number];
  var num_string = "";
  var ones_place = ['one', 'two', 'three',
                'four', 'five', 'six',
                'seven', 'eight', 'nine'];
  var tens_place = ['ten', 'twenty', 'thirty',
                'forty', 'fifty', 'sixty',
                'seventy', 'eighty', 'ninety'];
  var teenagers = ['eleven', 'twelve', 'thirteen',
                'fourteen', 'fifteen', 'sixteen',
                'seventeen', 'eighteen', 'nineteen'];
  var others = [[2,  'hundred'],
            [3,  'thousand'],
            [6,  'million'],
            [9,  'billion'],
            [12,  'trillion']];
  var left = number;
  while(others.length > 0){
    var other = others.pop();
    var write = Math.floor(left / Math.pow(10, other[0]));
    left = left - write * Math.pow(10, other[0]);
    if(write > 0){
      var pre = english_number1(write);
      num_string = num_string + pre + ' ' + other[1];
      if(left > 0){
        num_string += ' ';
      }
    }
  }
  write = Math.floor(left / 10);
  left = left - write * 10;
  if(write > 0){
    if((write == 1) && (left > 0)){
      num_string += teenagers[left - 1];
      left = 0;
    }else{
      num_string += tens_place[write - 1];
    }
    if(left > 0) num_string += '-';
  }
  write = left;
  left = 0;
  if(write > 0) num_string += ones_place[write - 1];
  english_numbers[number] = num_string;
  return num_string;
}
var c = parseInt($('#t1').val());
result += "メモ化無し: ";
var start = new Date();
for(var i = 0; i < c; i++){
  english_number(i);
}
var duration = (new Date() - start) / 1000;
result += duration + "秒\nメモ化有り: ";
start = new Date();
for(var i = 0; i < c; i++){
  english_number1(i);
}
duration = (new Date() - start) / 1000;
result += duration + "秒\n";
$('#pre0').text(result);



pythonの場合。

sample.py

コード(TextWrangler)

#!//usr//bin//env python3.3
#-*- coding: utf-8 -*-

def english_number(number):
    num_string = ""
    ones_place = ['one', 'two', 'three',
                  'four', 'five', 'six',
                  'seven', 'eight', 'nine']
    tens_place = ['ten', 'twenty', 'thirty',
                  'forty', 'fifty', 'sixty',
                  'seventy', 'eighty', 'ninety']
    teenagers = ['eleven', 'twelve', 'thirteen',
                  'fourteen', 'fifteen', 'sixteen',
                  'seventeen', 'eighteen', 'nineteen']
    others = [[2,  'hundred'],
              [3,  'thousand'],
              [6,  'million'],
              [9,  'billion'],
              [12,  'trillion']]
    left = number
    while others:
      other = others.pop()
      write = left // (10 ** other[0])
      left -= write * (10 ** other[0])
      if write > 0:
        pre = english_number(write)
        num_string = num_string + pre + ' ' + other[1]
        if left > 0:
          num_string += ' '
    
    write = left // 10
    left = left - write * 10
    if write > 0:
      if (write == 1) and (left > 0):
        num_string += teenagers[left - 1]
        left = 0
      else:
        num_string += tens_place[write - 1]
      
      if left > 0: num_string += '-'
    
    write = left
    left = 0
    if write > 0: num_string += ones_place[write - 1]
    return num_string

n = 100
while 1:
 print("{0} bottles of beer on the wall, {0} bottles of beer!".format(english_number(n)))
 n -= 1
 if n == 1: break
 print("Take one down, pass it around, {0} bottles of beer on the wall!".format(english_number(n)))

print("Take one down, pass it around, {0} bottle of beer on the wall!".format(english_number(n)))
print("{0} bottle of beer on the wall, {0} bottle of beer!".format(english_number(n)))
print("Take one down, pass it around, no more bottles of beer on the wall!")

# メモ化
english_numbers = {}
def english_number1(number):
    if number in english_numbers: return english_numbers[number]
    num_string = ""
    ones_place = ['one', 'two', 'three',
                  'four', 'five', 'six',
                  'seven', 'eight', 'nine']
    tens_place = ['ten', 'twenty', 'thirty',
                  'forty', 'fifty', 'sixty',
                  'seventy', 'eighty', 'ninety']
    teenagers = ['eleven', 'twelve', 'thirteen',
                  'fourteen', 'fifteen', 'sixteen',
                  'seventeen', 'eighteen', 'nineteen']
    others = [[2,  'hundred'],
              [3,  'thousand'],
              [6,  'million'],
              [9,  'billion'],
              [12,  'trillion']]
    left = number
    while others:
      other = others.pop()
      write = left // (10 ** other[0])
      left -= write * (10 ** other[0])
      if write > 0:
        pre = english_number1(write)
        num_string = num_string + pre + ' ' + other[1]
        if left > 0:
          num_string += ' '
    
    write = left // 10
    left = left - write * 10
    if write > 0:
      if (write == 1) and (left > 0):
        num_string += teenagers[left - 1]
        left = 0
      else:
        num_string += tens_place[write - 1]
      
      if left > 0: num_string += '-'
    
    write = left
    left = 0
    if write > 0: num_string += ones_place[write - 1]
    english_numbers[number] = num_string
    return num_string

c = 100000
import time
for d, f in [('メモ化無し',english_number), ('メモ化有り',english_number1)]:
    start = time.time()
    for n in range(c):
        f(n)
    print("{0}: {1}秒".format(d, time.time() - start))

入出力結果(Terminal)

$ ./sample.py
one hundred bottles of beer on the wall, one hundred bottles of beer!
Take one down, pass it around, ninety-nine bottles of beer on the wall!
ninety-nine bottles of beer on the wall, ninety-nine bottles of beer!
Take one down, pass it around, ninety-eight bottles of beer on the wall!
ninety-eight bottles of beer on the wall, ninety-eight bottles of beer!
Take one down, pass it around, ninety-seven bottles of beer on the wall!
ninety-seven bottles of beer on the wall, ninety-seven bottles of beer!
Take one down, pass it around, ninety-six bottles of beer on the wall!
ninety-six bottles of beer on the wall, ninety-six bottles of beer!
Take one down, pass it around, ninety-five bottles of beer on the wall!
ninety-five bottles of beer on the wall, ninety-five bottles of beer!
Take one down, pass it around, ninety-four bottles of beer on the wall!
ninety-four bottles of beer on the wall, ninety-four bottles of beer!
Take one down, pass it around, ninety-three bottles of beer on the wall!
ninety-three bottles of beer on the wall, ninety-three bottles of beer!
Take one down, pass it around, ninety-two bottles of beer on the wall!
ninety-two bottles of beer on the wall, ninety-two bottles of beer!
Take one down, pass it around, ninety-one bottles of beer on the wall!
ninety-one bottles of beer on the wall, ninety-one bottles of beer!
Take one down, pass it around, ninety bottles of beer on the wall!
ninety bottles of beer on the wall, ninety bottles of beer!
Take one down, pass it around, eighty-nine bottles of beer on the wall!
eighty-nine bottles of beer on the wall, eighty-nine bottles of beer!
Take one down, pass it around, eighty-eight bottles of beer on the wall!
eighty-eight bottles of beer on the wall, eighty-eight bottles of beer!
Take one down, pass it around, eighty-seven bottles of beer on the wall!
eighty-seven bottles of beer on the wall, eighty-seven bottles of beer!
Take one down, pass it around, eighty-six bottles of beer on the wall!
eighty-six bottles of beer on the wall, eighty-six bottles of beer!
Take one down, pass it around, eighty-five bottles of beer on the wall!
eighty-five bottles of beer on the wall, eighty-five bottles of beer!
Take one down, pass it around, eighty-four bottles of beer on the wall!
eighty-four bottles of beer on the wall, eighty-four bottles of beer!
Take one down, pass it around, eighty-three bottles of beer on the wall!
eighty-three bottles of beer on the wall, eighty-three bottles of beer!
Take one down, pass it around, eighty-two bottles of beer on the wall!
eighty-two bottles of beer on the wall, eighty-two bottles of beer!
Take one down, pass it around, eighty-one bottles of beer on the wall!
eighty-one bottles of beer on the wall, eighty-one bottles of beer!
Take one down, pass it around, eighty bottles of beer on the wall!
eighty bottles of beer on the wall, eighty bottles of beer!
Take one down, pass it around, seventy-nine bottles of beer on the wall!
seventy-nine bottles of beer on the wall, seventy-nine bottles of beer!
Take one down, pass it around, seventy-eight bottles of beer on the wall!
seventy-eight bottles of beer on the wall, seventy-eight bottles of beer!
Take one down, pass it around, seventy-seven bottles of beer on the wall!
seventy-seven bottles of beer on the wall, seventy-seven bottles of beer!
Take one down, pass it around, seventy-six bottles of beer on the wall!
seventy-six bottles of beer on the wall, seventy-six bottles of beer!
Take one down, pass it around, seventy-five bottles of beer on the wall!
seventy-five bottles of beer on the wall, seventy-five bottles of beer!
Take one down, pass it around, seventy-four bottles of beer on the wall!
seventy-four bottles of beer on the wall, seventy-four bottles of beer!
Take one down, pass it around, seventy-three bottles of beer on the wall!
seventy-three bottles of beer on the wall, seventy-three bottles of beer!
Take one down, pass it around, seventy-two bottles of beer on the wall!
seventy-two bottles of beer on the wall, seventy-two bottles of beer!
Take one down, pass it around, seventy-one bottles of beer on the wall!
seventy-one bottles of beer on the wall, seventy-one bottles of beer!
Take one down, pass it around, seventy bottles of beer on the wall!
seventy bottles of beer on the wall, seventy bottles of beer!
Take one down, pass it around, sixty-nine bottles of beer on the wall!
sixty-nine bottles of beer on the wall, sixty-nine bottles of beer!
Take one down, pass it around, sixty-eight bottles of beer on the wall!
sixty-eight bottles of beer on the wall, sixty-eight bottles of beer!
Take one down, pass it around, sixty-seven bottles of beer on the wall!
sixty-seven bottles of beer on the wall, sixty-seven bottles of beer!
Take one down, pass it around, sixty-six bottles of beer on the wall!
sixty-six bottles of beer on the wall, sixty-six bottles of beer!
Take one down, pass it around, sixty-five bottles of beer on the wall!
sixty-five bottles of beer on the wall, sixty-five bottles of beer!
Take one down, pass it around, sixty-four bottles of beer on the wall!
sixty-four bottles of beer on the wall, sixty-four bottles of beer!
Take one down, pass it around, sixty-three bottles of beer on the wall!
sixty-three bottles of beer on the wall, sixty-three bottles of beer!
Take one down, pass it around, sixty-two bottles of beer on the wall!
sixty-two bottles of beer on the wall, sixty-two bottles of beer!
Take one down, pass it around, sixty-one bottles of beer on the wall!
sixty-one bottles of beer on the wall, sixty-one bottles of beer!
Take one down, pass it around, sixty bottles of beer on the wall!
sixty bottles of beer on the wall, sixty bottles of beer!
Take one down, pass it around, fifty-nine bottles of beer on the wall!
fifty-nine bottles of beer on the wall, fifty-nine bottles of beer!
Take one down, pass it around, fifty-eight bottles of beer on the wall!
fifty-eight bottles of beer on the wall, fifty-eight bottles of beer!
Take one down, pass it around, fifty-seven bottles of beer on the wall!
fifty-seven bottles of beer on the wall, fifty-seven bottles of beer!
Take one down, pass it around, fifty-six bottles of beer on the wall!
fifty-six bottles of beer on the wall, fifty-six bottles of beer!
Take one down, pass it around, fifty-five bottles of beer on the wall!
fifty-five bottles of beer on the wall, fifty-five bottles of beer!
Take one down, pass it around, fifty-four bottles of beer on the wall!
fifty-four bottles of beer on the wall, fifty-four bottles of beer!
Take one down, pass it around, fifty-three bottles of beer on the wall!
fifty-three bottles of beer on the wall, fifty-three bottles of beer!
Take one down, pass it around, fifty-two bottles of beer on the wall!
fifty-two bottles of beer on the wall, fifty-two bottles of beer!
Take one down, pass it around, fifty-one bottles of beer on the wall!
fifty-one bottles of beer on the wall, fifty-one bottles of beer!
Take one down, pass it around, fifty bottles of beer on the wall!
fifty bottles of beer on the wall, fifty bottles of beer!
Take one down, pass it around, forty-nine bottles of beer on the wall!
forty-nine bottles of beer on the wall, forty-nine bottles of beer!
Take one down, pass it around, forty-eight bottles of beer on the wall!
forty-eight bottles of beer on the wall, forty-eight bottles of beer!
Take one down, pass it around, forty-seven bottles of beer on the wall!
forty-seven bottles of beer on the wall, forty-seven bottles of beer!
Take one down, pass it around, forty-six bottles of beer on the wall!
forty-six bottles of beer on the wall, forty-six bottles of beer!
Take one down, pass it around, forty-five bottles of beer on the wall!
forty-five bottles of beer on the wall, forty-five bottles of beer!
Take one down, pass it around, forty-four bottles of beer on the wall!
forty-four bottles of beer on the wall, forty-four bottles of beer!
Take one down, pass it around, forty-three bottles of beer on the wall!
forty-three bottles of beer on the wall, forty-three bottles of beer!
Take one down, pass it around, forty-two bottles of beer on the wall!
forty-two bottles of beer on the wall, forty-two bottles of beer!
Take one down, pass it around, forty-one bottles of beer on the wall!
forty-one bottles of beer on the wall, forty-one bottles of beer!
Take one down, pass it around, forty bottles of beer on the wall!
forty bottles of beer on the wall, forty bottles of beer!
Take one down, pass it around, thirty-nine bottles of beer on the wall!
thirty-nine bottles of beer on the wall, thirty-nine bottles of beer!
Take one down, pass it around, thirty-eight bottles of beer on the wall!
thirty-eight bottles of beer on the wall, thirty-eight bottles of beer!
Take one down, pass it around, thirty-seven bottles of beer on the wall!
thirty-seven bottles of beer on the wall, thirty-seven bottles of beer!
Take one down, pass it around, thirty-six bottles of beer on the wall!
thirty-six bottles of beer on the wall, thirty-six bottles of beer!
Take one down, pass it around, thirty-five bottles of beer on the wall!
thirty-five bottles of beer on the wall, thirty-five bottles of beer!
Take one down, pass it around, thirty-four bottles of beer on the wall!
thirty-four bottles of beer on the wall, thirty-four bottles of beer!
Take one down, pass it around, thirty-three bottles of beer on the wall!
thirty-three bottles of beer on the wall, thirty-three bottles of beer!
Take one down, pass it around, thirty-two bottles of beer on the wall!
thirty-two bottles of beer on the wall, thirty-two bottles of beer!
Take one down, pass it around, thirty-one bottles of beer on the wall!
thirty-one bottles of beer on the wall, thirty-one bottles of beer!
Take one down, pass it around, thirty bottles of beer on the wall!
thirty bottles of beer on the wall, thirty bottles of beer!
Take one down, pass it around, twenty-nine bottles of beer on the wall!
twenty-nine bottles of beer on the wall, twenty-nine bottles of beer!
Take one down, pass it around, twenty-eight bottles of beer on the wall!
twenty-eight bottles of beer on the wall, twenty-eight bottles of beer!
Take one down, pass it around, twenty-seven bottles of beer on the wall!
twenty-seven bottles of beer on the wall, twenty-seven bottles of beer!
Take one down, pass it around, twenty-six bottles of beer on the wall!
twenty-six bottles of beer on the wall, twenty-six bottles of beer!
Take one down, pass it around, twenty-five bottles of beer on the wall!
twenty-five bottles of beer on the wall, twenty-five bottles of beer!
Take one down, pass it around, twenty-four bottles of beer on the wall!
twenty-four bottles of beer on the wall, twenty-four bottles of beer!
Take one down, pass it around, twenty-three bottles of beer on the wall!
twenty-three bottles of beer on the wall, twenty-three bottles of beer!
Take one down, pass it around, twenty-two bottles of beer on the wall!
twenty-two bottles of beer on the wall, twenty-two bottles of beer!
Take one down, pass it around, twenty-one bottles of beer on the wall!
twenty-one bottles of beer on the wall, twenty-one bottles of beer!
Take one down, pass it around, twenty bottles of beer on the wall!
twenty bottles of beer on the wall, twenty bottles of beer!
Take one down, pass it around, nineteen bottles of beer on the wall!
nineteen bottles of beer on the wall, nineteen bottles of beer!
Take one down, pass it around, eighteen bottles of beer on the wall!
eighteen bottles of beer on the wall, eighteen bottles of beer!
Take one down, pass it around, seventeen bottles of beer on the wall!
seventeen bottles of beer on the wall, seventeen bottles of beer!
Take one down, pass it around, sixteen bottles of beer on the wall!
sixteen bottles of beer on the wall, sixteen bottles of beer!
Take one down, pass it around, fifteen bottles of beer on the wall!
fifteen bottles of beer on the wall, fifteen bottles of beer!
Take one down, pass it around, fourteen bottles of beer on the wall!
fourteen bottles of beer on the wall, fourteen bottles of beer!
Take one down, pass it around, thirteen bottles of beer on the wall!
thirteen bottles of beer on the wall, thirteen bottles of beer!
Take one down, pass it around, twelve bottles of beer on the wall!
twelve bottles of beer on the wall, twelve bottles of beer!
Take one down, pass it around, eleven bottles of beer on the wall!
eleven bottles of beer on the wall, eleven bottles of beer!
Take one down, pass it around, ten bottles of beer on the wall!
ten bottles of beer on the wall, ten bottles of beer!
Take one down, pass it around, nine bottles of beer on the wall!
nine bottles of beer on the wall, nine bottles of beer!
Take one down, pass it around, eight bottles of beer on the wall!
eight bottles of beer on the wall, eight bottles of beer!
Take one down, pass it around, seven bottles of beer on the wall!
seven bottles of beer on the wall, seven bottles of beer!
Take one down, pass it around, six bottles of beer on the wall!
six bottles of beer on the wall, six bottles of beer!
Take one down, pass it around, five bottles of beer on the wall!
five bottles of beer on the wall, five bottles of beer!
Take one down, pass it around, four bottles of beer on the wall!
four bottles of beer on the wall, four bottles of beer!
Take one down, pass it around, three bottles of beer on the wall!
three bottles of beer on the wall, three bottles of beer!
Take one down, pass it around, two bottles of beer on the wall!
two bottles of beer on the wall, two bottles of beer!
Take one down, pass it around, one bottle of beer on the wall!
one bottle of beer on the wall, one bottle of beer!
Take one down, pass it around, no more bottles of beer on the wall!
メモ化無し: 5.372998952865601秒
メモ化有り: 2.2767961025238037秒
$

入出力結果の先頭に戻る

0 コメント:

コメントを投稿