Comment detail

FizzBuzz問題の一般化 (Nested Flatten)
こんなんで如何でしょう?
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
Module Module1
    Sub Main(ByVal args() As String)
        For i As Integer = Integer.Parse(args(0)) To Integer.Parse(args(1))
            Dim Line As String = ""
            For j As Integer = 1 To args(1).Length - i.ToString.Length
                Line &= " "
            Next
            Line &= i.ToString & ":"
            Dim IsHoge As Boolean = True
            For j As Integer = 2 To args.Length - 2 Step 2
                If i Mod Integer.Parse(args(j)) = 0 Then
                    Line &= args(j + 1)
                    IsHoge = False
                End If
            Next
            If IsHoge Then
                Line &= "hoge"
            End If
            Console.WriteLine(Line)
        Next
    End Sub
End Module

Index

Feed

Other

Link

Pathtraq

loading...