zoukankan      html  css  js  c++  java
  • 对不起,我是一个程序猿

    程序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

  • 相关阅读:
    Parameter HTTP 参数基类
    XMLHttpRequest对象 转载来源于:http://dev.yesky.com
    35 岁前程序员要规划好的四件事
    java 初学之二
    从零开始学wordpress 之四
    Adobe flash cs5 的Java运行时环境初始化错误 完美解决方法
    从零开始学wordpress 之三
    java 初学 之一
    java 初学之三 多态和抽象类
    简单的js优化
  • 原文地址:https://www.cnblogs.com/crazyghostvon/p/3979269.html
Copyright © 2011-2022 走看看