Exemplo n.º 1
0
 public void findSubSeqAP()
 {
     if (isAP(SubSeq, nSub))
     {
         numofAps++;
     }
     for (int i = seqBegin; i < nSeq; i++)
     {
         SubSeq[nSub] = Sequence[i];
         SubSequence sq = new SubSequence(Sequence, nSeq, i + 1, SubSeq, nSub + 1);
         sq.findSubSeqAP();
         numofAps += sq.getNumAP();
     }
 }
Exemplo n.º 2
0
        //WalmartLabs Codesprint(Algorithms)  Count Your Progressions
        static void Main(String[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());

            int[] num = new int[n];
            for (int i = 0; i < n; i++)
            {
                num[i] = Convert.ToInt32(Console.ReadLine());
            }
            SubSequence sq = new SubSequence(num, n);

            sq.findSubSeqAP();
            Console.WriteLine(sq.getNumAP());
        }