数独问题全解

      数独是一个很多人都喜欢的游戏。对于这样的问题,我比较喜欢的解决方案是写一个程序来解决这些问题。不过这些问题显然是那种需要回溯需要优化的问题。游戏规则我就不罗嗦了,言归正传。
      首先是解决数独问题的算法。程序输入,一个9*9的输入矩阵,有数字的地方就是指定的数字,没有数字的地方输入为0。算法的主要思想如下:
      1、创建一个堆栈trackStack,用来保存用程序填入的格子的信息。
      2、查找所有的数字为0的地方,察看这些地方所有的可能选择的数量,找到最小数量的那个格子。
      3、如果找到的最小数量为0的话,表明没有数字可以填写了。从trackStack中弹出一项,重新填写这个格子可能的一个数据。重复2;
      4、如果找到的最小数量不是0的话,在格子中填入最小的可能数据,将填入的格子的信息压入堆栈trackStack。如果还有格子为空,重复2;
      5、结束。

下面是完整的程序:

 

None.gif using  System;
None.gif
using  System.Collections.Generic;
None.gif
using  System.Text;
None.gif
using  System.IO;
None.gif
None.gif
namespace  sodoku
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gif    
class DataItem
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
public int i;
InBlock.gif        
public int j;
InBlock.gif        
public int value ;
ExpandedSubBlockEnd.gif    }

InBlock.gif    
class Program
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
static bool bContinue = true ;
InBlock.gif        
static Stack<DataItem> trackStack = new Stack<DataItem>();
InBlock.gif        
static void OutputResult(int[][] iData)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
for(int i = 0 ; i < 9 ; i++ )
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Console.WriteLine();
InBlock.gif                
for (int j = 0; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    Console.Write(
"{0}\t", iData[i][j]);
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
static bool CheckValidInput(int[][] iData)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
static int SearchMinOptions(int[][] iData)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
int iMaxCount = 0;
InBlock.gif            
int iRow = 0, iColumn = 0;
InBlock.gif            
int iMinNum = 0;
InBlock.gif
InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
for (int j = 0; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (iData[i][j] == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
int[] iFlag = new int[10];
InBlock.gif                        
for (int m = 0; m < 10; m++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            iFlag[m] 
= 0;
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
for (int k = 0; k < 9; k++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            iFlag[iData[i][k]] 
= 1;
InBlock.gif                            iFlag[iData[k][j]] 
= 1;
InBlock.gif                            iFlag[iData[i 
/ 3 * 3+ k / 3][j / 3 * 3+ k % 3]] = 1;
ExpandedSubBlockEnd.gif                        }

InBlock.gif
InBlock.gif                        
int iCount = 0;
InBlock.gif                        
int iCurrMinNum = 0;
InBlock.gif                        
for (int m = 1; m < 10; m++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
if (iFlag[m] == 1)
InBlock.gif                                iCount
++;
InBlock.gif                            
if (iFlag[m] == 0 && iCurrMinNum == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                iCurrMinNum 
= m;
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
if (iCount > iMaxCount)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            iRow 
= i;
InBlock.gif                            iColumn 
= j;
InBlock.gif                            iMaxCount 
= iCount;
InBlock.gif                            iMinNum 
= iCurrMinNum;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
if (iMinNum == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
//OutputResult(iData);
InBlock.gif                
//check whether finished
InBlock.gif
                if( CheckFinished(iData) )
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    Console.WriteLine( 
"Result:" ) ;
InBlock.gif                    OutputResult( iData) ;
InBlock.gif                    bContinue 
= false ;
InBlock.gif                    
return 0 ;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
do 
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
if (trackStack.Count == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            Console.WriteLine(
"Error!");
InBlock.gif                            bContinue 
= false;
InBlock.gif                            
return 0;
ExpandedSubBlockEnd.gif                        }

InBlock.gif
InBlock.gif                        DataItem item 
= trackStack.Pop() ;
InBlock.gif                        
int[] iFlag = new int[10];
InBlock.gif                        
for (int m = 0; m < 10; m++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            iFlag[m] 
= 0;
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
for (int k = 0; k < 9; k++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            iFlag[iData[item.i][k]] 
= 1;
InBlock.gif                            iFlag[iData[k][item.j]] 
= 1;
InBlock.gif                            iFlag[iData[item.i 
/ 3 * 3+ k / 3][item.j / 3 * 3+ k % 3]] = 1;
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
for (int m = item.value + 1; m < 10; m++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
if (iFlag[m] == 0 && m > item.value )
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                iData[item.i][item.j] 
= m ;
InBlock.gif                                item.value 
= m ;
InBlock.gif                                trackStack.Push( item ) ;
InBlock.gif                                
return SearchMinOptions(iData);
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }
while(true ) ;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            Console.WriteLine();
InBlock.gif            Console.WriteLine(
"X:{0},Y:{1},Num:{2}", iRow, iColumn,iMinNum);
InBlock.gif            DataItem item2 
= new DataItem();
InBlock.gif
InBlock.gif            item2.i 
= iRow;
InBlock.gif            item2.j 
= iColumn;
InBlock.gif            item2.value 
= iMinNum;
InBlock.gif
InBlock.gif            trackStack.Push(item2);
InBlock.gif
InBlock.gif            iData[iRow][iColumn] 
= iMinNum;
InBlock.gif            
return 0;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
static bool CheckFinished(int[][] iData)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
bool bFinished = true;
InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
for (int j = 0; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (iData[i][j] == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        bFinished 
= false;
InBlock.gif                        
break;
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
return bFinished;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
static void Main(string[] args)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
string[] strAll = System.IO.File.ReadAllLines(@"D:\Test\sodoku\example.txt");
InBlock.gif
InBlock.gif            
int[][] iData = new int[9][] ;
InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                iData[i] 
= new int[9];
ExpandedSubBlockEnd.gif            }

InBlock.gif            
int iIndex = 0;
InBlock.gif            
foreach (string strLine in strAll)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
string[] strData = strLine.Split("\t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
InBlock.gif                
if (strData.Length != 9)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
continue;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
forint i = 0 ; i < 9 ; i ++ )
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    iData[iIndex][i] 
= Convert.ToInt32(strData[i]) ;
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                iIndex 
++ ;
InBlock.gif                
if( iIndex == 9 )
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
break ;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif
InBlock.gif            
if( iIndex != 9 )
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Console.WriteLine( 
"Error reading file,must input 9 lines valid data!" ) ;
InBlock.gif                
return ;
ExpandedSubBlockEnd.gif            }

InBlock.gif            OutputResult( iData ) ;
InBlock.gif
InBlock.gif
InBlock.gif            CheckValidInput(iData);
InBlock.gif
InBlock.gif            
do
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                SearchMinOptions(iData);
InBlock.gif                
//OutputResult(iData);
InBlock.gif                
//Console.ReadLine() ;
ExpandedSubBlockEnd.gif
            }

InBlock.gif            
while (bContinue);
InBlock.gif            Console.ReadLine();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif


下面是一个输入的例子:
0 6 0 0 0 5 2 0 4
0 2 0 0 1 6 0 0 3
0 5 3 0 0 4 0 0 0
2 0 0 0 7 1 9 0 8
1 0 0 9 0 0 7 4 0
4 0 9 0 6 0 0 0 0
0 1 2 6 0 0 8 0 9
0 4 7 8 2 0 1 0 5
0 0 0 0 5 0 4 0 0

      OK,上面的是我们解决数独问题的一个方法。接下来,我们需要讨论一下如何生成一个数独游戏,在生成数独游戏的过程中,我们首先需要做一些思考。对于8皇后问题,我想很多人都是知道的。其实对于我们的这个问题,其实和8皇后问题,有很大的相似的地方。仔细观察我们的数独游戏的规则,我们可以发现,如果只看一个数字,例如看2,其他的数字我们全部去掉话,这个问题不就是一个变形的8皇后问题吗?而且,我们自己观察那1到9的9个数字,其实是1-9还是A-I是没有什么差别的,这9个数字之间是相互对等的。也就是说,我们求解的目标是,一个皇后,她攻击的范围是和她同一行或者同一列或者在同一个九宫,现在有9*9的格子,里面需要放9个皇后,皇后之间不能相互攻击。我们需要计算出所有可能的皇后的解决方案。得到这些解决方案的列表以后,我们一共有9种颜色的皇后,每一种颜色的皇后都只能从刚才的得到的解决方案的列表中找到一个方案,而这9个方案放到一个相同的9*9的格子里面的时候,不能有任何的重叠。得到了这9个方案,分别将这9个方案对应一个数字。然后随机的从里面去掉一些数字。一个数独游戏就产生了。

      下面是代码,希望大家喜欢,有问题给我留言,或者邮件lujianping@china.com.cn
   

ContractedBlock.gif ExpandedBlockStart.gif 数独创建
None.gifusing System;
None.gif
using System.Collections.Generic;
None.gif
using System.Text;
None.gif
None.gif
namespace sdCreator
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
InBlock.gif    
class Program
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
static void OutputResult(int[][] iData)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Console.WriteLine();
InBlock.gif                
for (int j = 0; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    Console.Write(
"{0}\t", iData[i][j]);
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif        
class POINT
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
public int i;
InBlock.gif            
public int j;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
static void OutputResult(Stack<POINT> track)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
foreach (POINT pnt in track)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                Console.Write(
"{0},{1};", pnt.i, pnt.j);
ExpandedSubBlockEnd.gif            }

InBlock.gif            Console.WriteLine();
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
static bool ConflictData(int i, int j, Stack<POINT> track)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
foreach (POINT pnt in track)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (pnt.i == i || pnt.j == j || (pnt.i / 3 == i / 3 && pnt.j / 3 == j / 3))
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return true;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
return false;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
static List<Stack<POINT>> opt = new List<Stack<POINT>>();
InBlock.gif        
static void CalcSoduCount()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
int iCount = 0;
InBlock.gif            Stack
<POINT> track = new Stack<POINT>();
InBlock.gif            
int iCurrentLine = 0;
InBlock.gif            
while (true)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
bool bFind = false;
InBlock.gif                
for (int j = 0; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (!ConflictData(iCurrentLine , j, track))
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        POINT pnt 
= new POINT();
InBlock.gif                        pnt.i 
= iCurrentLine;
InBlock.gif                        pnt.j 
= j;
InBlock.gif                        track.Push(pnt);
InBlock.gif                        bFind 
= true;
InBlock.gif                        iCurrentLine
++;
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

InBlock.gif                
if (bFind == false)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
//revert
InBlock.gif
                    do
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        POINT pnt 
= track.Pop();
InBlock.gif                        bFind 
= false;
InBlock.gif                        
for (int j = pnt.j + 1; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
if (!ConflictData(pnt.i, j, track))
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                pnt.j 
= j;
InBlock.gif                                track.Push(pnt);
InBlock.gif                                bFind 
= true;
InBlock.gif                                iCurrentLine 
= pnt.i + 1 ;
InBlock.gif                                
break;
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
if (bFind == true)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
break;
ExpandedSubBlockEnd.gif                        }

ExpandedSubBlockEnd.gif                    }

InBlock.gif                    
while (true);
InBlock.gif
ExpandedSubBlockEnd.gif                }

InBlock.gif                
else
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if (track.Count == 9)
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        
//Console.WriteLine("Find one Result");
InBlock.gif                        
//OutputResult(track);
InBlock.gif
                        Stack<POINT> newStack = new Stack<POINT>();
InBlock.gif                        
foreach (POINT pnt in track)
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            POINT newPnt 
= new POINT();
InBlock.gif                            newPnt.i 
= pnt.i;
InBlock.gif                            newPnt.j 
= pnt.j;
InBlock.gif                            newStack.Push(newPnt);
ExpandedSubBlockEnd.gif                        }

InBlock.gif                        opt.Add(newStack);
InBlock.gif                        iCount
++;
InBlock.gif                        
do
ExpandedSubBlockStart.gifContractedSubBlock.gif                        
dot.gif{
InBlock.gif                            
if (track.Count == 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                Console.WriteLine(
"Total Count:{0}" , iCount );
InBlock.gif                                
return;
ExpandedSubBlockEnd.gif                            }

InBlock.gif                            POINT pnt 
= track.Pop();
InBlock.gif                            bFind 
= false;
InBlock.gif                            
for (int j = pnt.j + 1; j < 9; j++)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
if (!ConflictData(pnt.i, j, track))
ExpandedSubBlockStart.gifContractedSubBlock.gif                                
dot.gif{
InBlock.gif                                    pnt.j 
= j;
InBlock.gif                                    track.Push(pnt);
InBlock.gif                                    bFind 
= true;
InBlock.gif                                    iCurrentLine 
= pnt.i + 1;
InBlock.gif                                    
break;
ExpandedSubBlockEnd.gif                                }

ExpandedSubBlockEnd.gif                            }

InBlock.gif                            
if (bFind == true)
ExpandedSubBlockStart.gifContractedSubBlock.gif                            
dot.gif{
InBlock.gif                                
break;
ExpandedSubBlockEnd.gif                            }

ExpandedSubBlockEnd.gif                        }

InBlock.gif                        
while (true);
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            OutputResult(track);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
static bool AddOneResult(int[][] iData, Stack<POINT> track , int iValue)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
foreach (POINT pnt in track)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
if (iData[pnt.i][pnt.j] != 0)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
return false;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
foreach (POINT pnt in track)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                iData[pnt.i][pnt.j] 
= iValue;
ExpandedSubBlockEnd.gif            }

InBlock.gif            
return true;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        
static void SearchOneSolution()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
int[][] iData = new int[9][];
InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                iData[i] 
= new int[9];
ExpandedSubBlockEnd.gif            }

InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
forint j = 0 ; j < 9 ; j ++ )
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    iData[i][j] 
= 0 ;
ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            
int iStart = 1000 ;
InBlock.gif            
for (int i = 0; i < 9; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
for ( int j = iStart ; j < opt.Count ; j ++ )
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
if( AddOneResult( iData , opt[j] , i ) )
ExpandedSubBlockStart.gifContractedSubBlock.gif                    
dot.gif{
InBlock.gif                        iStart 
= j + 1 ;
InBlock.gif                        
break ;
ExpandedSubBlockEnd.gif                    }

ExpandedSubBlockEnd.gif                }

ExpandedSubBlockEnd.gif            }

InBlock.gif            OutputResult( iData ) ;
ExpandedSubBlockEnd.gif        }

InBlock.gif        
static void Main(string[] args)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            CalcSoduCount();
InBlock.gif
InBlock.gif            SearchOneSolution();
InBlock.gif            Console.ReadLine();
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

转载于:https://www.cnblogs.com/abdias/archive/2007/04/16/715423.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值