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

  • 相关阅读:
    て和で用法的总结
    假如程序员上热搜是什么样的?网友:毫无违和感!
    一年精通,三年熟悉,五年了解,十年用过!C++真的这么难吗?
    新手上路,“hello word”其实是在告诉计算机又有菜鸟来了!
    从原理到方法,一步到位,教你如何应对C语言内存泄露!
    冰冷的英语字母,枯燥的编程教程,果断选择了放弃!真的吗?
    只有了解程序员的黑话,和他们打成一片获得buff加成,产品才能尽早上线!
    C语言编程小游戏「石头剪刀布」!源码分享~
    一行代码卖出570美元,什么样的代码能这么值钱?带你揭秘天价代码的内幕!
    源码解剖HashMap
  • 原文地址:https://www.cnblogs.com/crazyghostvon/p/3979269.html
Copyright © 2011-2022 走看看