4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

誰も得しない千反田える.php

Last updated at Posted at 2013-05-29

単に書いてみたかっただけや...

chitandaeru.php

<?php

$x = ['', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
$y = ['', '十', '百', '千'];
$yy = ['', '万', '億', '兆'];
$z = ['えー', 'びー', 'しー', 'でー', 'いー', 'えふ', 'じー', 'えいち', 'あい', 'じぇい', 'けー', 'える', 'えむ', 'えぬ', 'おー', 'ぴー', 'きゅー', 'あーる', 'えす', 'てぃー', 'ゆー', 'ぶい', 'だぶりゅー', 'えっくす', 'わい', 'ぜっと'];

foreach (range(1, 1000) as $l) {
    $ln = '';
    foreach (array_map('strrev', str_split(strrev($l), 4)) as $m => $i) {
        $tl = '';
        foreach (str_split($i) as $j => $c) {
            $k = strlen($i) - $j - 1;
            if ($c >= 2 || ($c == 1 && $k == 0)) {
                $tl .= $x[$c];
            }
            if ($c > 0) {
                $tl .= $y[$k];
            }
        }
        if ($m > 0) {
            $tl .= $yy[$m];
        }
        $ln = $tl . $ln;
    }

    $fn = $z[($l - 1) % 26];

    echo $ln, '反田', $fn, PHP_EOL;
}

ほんとだすごい。

% php chitandaeru.php | tail
九百九十一反田しー
九百九十二反田でー
九百九十三反田いー
九百九十四反田えふ
九百九十五反田じー
九百九十六反田えいち
九百九十七反田あい
九百九十八反田じぇい
九百九十九反田けー
千反田える

(ちなみに無駄に 1000 over にも対応してます)

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?