LoginSignup
0
0

More than 5 years have passed since last update.

十字の壁がそそり立つ世界の中を君は螺旋状に歩く (規則性、PowerShell)

Last updated at Posted at 2016-10-01
問題 http://nabetani.sakura.ne.jp/hena/ord28spirwa/
シミュレーション (Python/Ruby/C++) http://qiita.com/cielavenir/items/8c77a158136bd668a27b
規則性 (Python/Ruby/C/C#/Java) http://qiita.com/cielavenir/items/a285b0cea4a26ff886b8
規則性 (D/Go/Swift/PHP/ Vala ) http://qiita.com/cielavenir/items/edb1daff9ea861a418ec
規則性 (VB/F#/Perl) http://qiita.com/cielavenir/items/0c84af4049ab161f82c1
規則性 (PowerShell) http://qiita.com/cielavenir/items/d9ef9f12068e99e888f2
規則性 ( AIR-lang ) http://qiita.com/cielavenir/items/d804f61412fb4f07ba06
規則性 (Crystal/Perl6) http://qiita.com/cielavenir/items/13896a662b05da8b77a2
Rubyの多次元配列で最初の要素を加工して返したい
(tap/break等について)
http://qiita.com/cielavenir/items/3f209351b924e2615f5e
tyama_hena28_fast.ps1
#!/usr/bin/env powershell
#http://qiita.com/Nabetani/items/23ebddb44f0234e7fb15
#http://nabetani.sakura.ne.jp/hena/ord28spirwa/

$dir="ESWN"
while(1){
    $line=[Console]::ReadLine()
    if($line.length -eq 0){break}
    $a=$line.Split(":")
    $b=$a[0].Split(",")
    $n=[Convert]::ToInt32($b[0])
    $e=[Convert]::ToInt32($b[1])
    $s=[Convert]::ToInt32($b[2])
    $w=[Convert]::ToInt32($b[3])
    $days=[Convert]::ToInt64($a[1])
    $days+=1
    [int[]]$l=@($e,$s,$w,$n)
    $i=0
    $f=1
    for(;$f;$i++){
        [int[]]$x=@( # それぞれ括弧でくくらないとだめっぽい
            ($l[$i%4]+($i%4 -eq 0)),
            (([Math]::Floor($i/4)+1)*2),
            ($l[$i%4]-($i%4 -eq 3))
        )
        for($j=0;$j -lt 3;$j++){
            if($days-$x[$j] -lt 0){
                [Console]::WriteLine($dir[($i+$j)%4])
                $f=0
                break
            }
            $days-=$x[$j]
        }
    }
    [Console]::Out.Flush()
}
0
0
3

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
0
0