码迷,mamicode.com
首页 > 其他好文 > 详细

对不起,我是一个程序猿

时间:2014-09-18 16:24:54      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   for   2014   div   sp   log   

bubuko.com,布布扣

程序VB。net:

 

Module Module1

    Sub Main()
        Console.WriteLine(DateTime.Now.ToLongTimeString())
        Dim count As Long = 0

        For a1 As Integer = 1 To 4
            For b2 As Integer = 1 To 4
                For c3 As Integer = 1 To 4
                    For d4 As Integer = 1 To 4
                        For e5 As Integer = 1 To 4
                            For f6 As Integer = 1 To 4
                                For g7 As Integer = 1 To 4
                                    For h8 As Integer = 1 To 4
                                        For i9 As Integer = 1 To 4
                                            For j0 As Integer = 1 To 4
                                                count += 1
                                                Dim success As Boolean = True

                                                case 1
                                                If a1 = 2 Then
                                                    If b2 <> 1 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If a1 = 3 Then
                                                    If c3 <> 1 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If a1 = 4 Then
                                                    If d4 <> 1 Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 2
                                                If b2 = 1 Then
                                                    If e5 <> f6 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If b2 = 2 Then
                                                    If f6 <> g7 Or (a1 = b2 Or b2 = c3 Or c3 = d4 Or d4 = e5 Or e5 = f6 Or g7 = h8 Or h8 = i9 Or i9 = j0) Then
                                                        Continue For
                                                    End If
                                                End If
                                                If b2 = 3 Then
                                                    If g7 <> h8 Or (a1 = b2 Or b2 = c3 Or c3 = d4 Or d4 = e5 Or e5 = f6 Or f6 = g7 Or h8 = i9 Or i9 = j0) Then
                                                        Continue For
                                                    End If
                                                End If
                                                If b2 = 4 Then
                                                    If h8 <> i9 Or (a1 = b2 Or b2 = c3 Or c3 = d4 Or d4 = e5 Or e5 = f6 Or f6 = g7 Or g7 = h8 Or i9 = j0) Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 3
                                                If c3 = 1 Then
                                                    If d4 <> 1 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If c3 = 2 Then
                                                    If i9 <> 2 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If c3 = 3 Then
                                                    If g7 <> h8 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If c3 = 4 Then
                                                    If h8 <> i9 Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 4
                                                Dim countA As Integer = 0
                                                If a1 = 1 Then countA += 1
                                                If b2 = 1 Then countA += 1
                                                If c3 = 1 Then countA += 1
                                                If d4 = 1 Then countA += 1
                                                If e5 = 1 Then countA += 1
                                                If f6 = 1 Then countA += 1
                                                If g7 = 1 Then countA += 1
                                                If h8 = 1 Then countA += 1
                                                If i9 = 1 Then countA += 1
                                                If j0 = 1 Then countA += 1

                                                If d4 = 1 Then
                                                    If countA <> 5 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If d4 = 2 Then
                                                    If countA <> 4 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If d4 = 3 Then
                                                    If countA <> 3 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If d4 = 4 Then
                                                    If countA <> 2 Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 5
                                                If e5 = 1 Then
                                                    If a1 <> 1 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If e5 = 2 Then
                                                    If b2 <> 2 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If e5 = 3 Then
                                                    If c3 <> 3 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If e5 = 4 Then
                                                    If d4 <> 4 Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 6
                                                Dim countB As Integer = 0
                                                If a1 = 2 Then countB += 1
                                                If b2 = 2 Then countB += 1
                                                If c3 = 2 Then countB += 1
                                                If d4 = 2 Then countB += 1
                                                If e5 = 2 Then countB += 1
                                                If f6 = 2 Then countB += 1
                                                If g7 = 2 Then countB += 1
                                                If h8 = 2 Then countB += 1
                                                If i9 = 2 Then countB += 1
                                                If j0 = 2 Then countB += 1

                                                Dim countC As Integer = 0
                                                If a1 = 3 Then countC += 1
                                                If b2 = 3 Then countC += 1
                                                If c3 = 3 Then countC += 1
                                                If d4 = 3 Then countC += 1
                                                If e5 = 3 Then countC += 1
                                                If f6 = 3 Then countC += 1
                                                If g7 = 3 Then countC += 1
                                                If h8 = 3 Then countC += 1
                                                If i9 = 3 Then countC += 1
                                                If j0 = 3 Then countC += 1

                                                Dim countD As Integer = 0
                                                If a1 = 4 Then countD += 1
                                                If b2 = 4 Then countD += 1
                                                If c3 = 4 Then countD += 1
                                                If d4 = 4 Then countD += 1
                                                If e5 = 4 Then countD += 1
                                                If f6 = 4 Then countD += 1
                                                If g7 = 4 Then countD += 1
                                                If h8 = 4 Then countD += 1
                                                If i9 = 4 Then countD += 1
                                                If j0 = 4 Then countD += 1

                                                If f6 = 1 Then
                                                    If countA = countB Or countA = countC Or countA = countD Then
                                                        Continue For
                                                    End If
                                                End If
                                                If f6 = 2 Then
                                                    If countA <> countC Then
                                                        Continue For
                                                    End If
                                                End If
                                                If f6 = 3 Then
                                                    If countA <> countC Then
                                                        Continue For
                                                    End If
                                                End If
                                                If f6 = 4 Then
                                                    If countA <> countD Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 7
                                                If g7 = 3 Then
                                                    If h8 <> 4 Or h8 <> 2 Then
                                                        Continue For
                                                    End If
                                                Else
                                                    If h8 <> 4 Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 8
                                                If h8 = 1 Then
                                                    If countA <> 0 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If h8 = 2 Then
                                                    If countA <> 1 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If h8 = 3 Then
                                                    If countA <> 2 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If h8 = 4 Then
                                                    If countA <> 3 Then
                                                        Continue For
                                                    End If
                                                End If

                                                case 9
                                                If i9 = 1 Then
                                                    If (countB + countC + countD) Mod 2 <> 0 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If i9 = 2 Then
                                                    If (countB + countC + countD) Mod 2 <> 1 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If i9 = 3 Then
                                                    If (countB + countC + countD) >= 5 Then
                                                        Continue For
                                                    End If
                                                End If
                                                If i9 = 4 Then
                                                    If (countB + countC + countD) <> 1 And (countB + countC + countD) <> 4 And (countB + countC + countD) <> 9 Then
                                                        Continue For
                                                    End If
                                                End If

                                                If success Then
                                                    Console.WriteLine("{0}  {1}  {2}  {3}  {4}  {5}  {6}  {7}  {8}  {9}", a1, b2, c3, d4, e5, f6, g7, h8, i9, j0)                                                
                                                Else

                                                End If
                                            Next
                                        Next
                                    Next
                                Next
                            Next
                        Next
                    Next
                Next
            Next
        Next

        Console.WriteLine(DateTime.Now.ToLongTimeString())
        Console.ReadKey()

    End Sub

End Module

结果:ACBCACDDBA

bubuko.com,布布扣

 

对不起,我是一个程序猿

标签:style   blog   http   color   for   2014   div   sp   log   

原文地址:http://www.cnblogs.com/crazyghostvon/p/3979269.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!