示例#1
0
 static public void WriteIsOdd(int[] permutation)
 {
     int[][] cyclePermutation = WithoutRepetition.PermutationToCycle(permutation);
     using (StreamWriter writer = new StreamWriter("log.txt", true))
     {
         WriteDate(writer);
         WriteLine(writer, "If permutation is odd:");
         WriteLine(writer);
         Write(writer, "One-line notation: ");
         WriteVector(writer, permutation);
         WriteLine(writer);
         Write(writer, "Canonical cycle notation: ");
         WriteCycle(writer, cyclePermutation);
         WriteLine(writer);
         WriteLine(writer);
         Write(writer, "Is odd? - ");
         if (WithoutRepetition.IsOdd(permutation))
         {
             Write(writer, "yes");
         }
         else
         {
             Write(writer, "no");
         }
         WriteLine(writer);
     }
 }