Last active
December 21, 2015 15:39
-
-
Save chris-x86-64/6327655 to your computer and use it in GitHub Desktop.
千反田える
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
my @numeric_characters = ('', '一', '二', '三', '四', '五', '六', '七', '八', '九'); | |
my @digits = ('', '十', '百', '千'); | |
my @alphabets = ( | |
'えー', | |
'びー', | |
'しー', | |
'でぃー', | |
'いー', | |
'えふ', | |
'じー', | |
'えいち', | |
'あい', | |
'じぇー', | |
'けー', | |
'える', | |
'えむ', | |
'えぬ', | |
'おー', | |
'ぴー', | |
'きゅー', | |
'あーる', | |
'えす', | |
'てぃー', | |
'ゆー', | |
'ぶい', | |
'だぶりゅー', | |
'えっくす', | |
'わい', | |
'ぜっと' | |
); | |
for my $count (1 .. 1000) { | |
my @number_kanji; | |
my @number = reverse($count =~ /\d/g); | |
for my $i (0 .. $#number) { | |
push (@number_kanji, $digits[$i]) if $number[$i] >= 1; | |
push (@number_kanji, $numeric_characters[ $number[$i] ]) if ($number[$i] > 1) or ($i == 0); | |
} | |
print reverse(@number_kanji); | |
say '反田' . $alphabets[ ($count - 1) % 26 ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
0ケタ目 (すなわち一の位) については漢数字を出力するようにロジックを変えたら完璧になった。完成!