oj 3454 C # string consisting exam

Title Description

No questions have been assumed to obtain in the exam, and stored in an array arrayKT in. E.g., int [] arrayKT = {10,13,18,19,20,22,30,31}. Member defines a static method, the method is implemented randomly selected from said array n (n = arrayKT.Length-1) track questions, questions and form a string. For example, randomly selected question from n arrayKT exam constitutive string: "10,13,18,20,22,30,31." Requirements, the composition will not be repeated exam the exam string, all possible output strings.

Entry

The number of subject
exam number array;

Export

All possible questions strings;

using System;
using System.IO;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;

namespace myApp
{
    class Program
    {

        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int a = int.Parse(s);
            string s1 = Console.ReadLine();
            string[] s2 = s1.Split(' ');
            int[] b = Array.ConvertAll(s2, int.Parse);

            Test(b);
        }
        public static void Test(int[] arrayKT)
        {
            int i = 0;
            int n = arrayKT.Length ;
            for (i = n-1; i >=0; i--)
            {
                for (int j = 0; j < arrayKT.Length; j++)
                {
                    if (arrayKT[i] == arrayKT[j])
                    {
                        i = j;
                    }
                    else
                    {
                        Console.Write("{0} ", arrayKT[j]);
                    }

                }
                Console.WriteLine();

            }

        }
    }

}

Published 14 original articles · won praise 14 · views 634

Guess you like

Origin blog.csdn.net/weixin_46292455/article/details/104931651