コード例 #1
0
ファイル: Subsets.cs プロジェクト: saber13812002/QuranCode
    private static void Main(string[] args)
    {
        long[] word_lengths = new long[]
        {
            3, 4, 6, 6,
            5, 3, 2, 7,
            6, 6,
            3, 3, 5,
            4, 4, 5, 6,
            5, 5, 8,
            3, 5, 5, 5, 3, 7, 5, 3, 7
        };
        Subsets subsets = new Subsets(word_lengths);

        int  count = 7;
        long sum   = 29;

        Stopwatch stopwatch = Stopwatch.StartNew();

        m_count = 0L;
        subsets.Find(count, sum, OnFound);
        stopwatch.Stop();

        Console.WriteLine("Subsets found: " + m_count);
        Console.WriteLine(stopwatch.Elapsed);
        Console.ReadKey();
    }
コード例 #2
0
    public List <List <Chapter> > Find(int number_of_chapters, int number_of_verses)
    {
        m_subsets = new List <List <Chapter> >();

        long[] chapter_verse_counts = new long[m_items.Count];
        for (int i = 0; i < m_items.Count; i++)
        {
            chapter_verse_counts[i] = m_items[i].Verses.Count;
        }

        Subsets subsets = new Subsets(chapter_verse_counts);

        subsets.Find(number_of_chapters, number_of_verses, OnFound);

        return(m_subsets);
    }
コード例 #3
0
    public List <List <Verse> > Find(int number_of_verses, int number_of_words)
    {
        m_subsets = new List <List <Verse> >();

        long[] verse_word_counts = new long[m_items.Count];
        for (int i = 0; i < m_items.Count; i++)
        {
            verse_word_counts[i] = m_items[i].Words.Count;
        }

        Subsets subsets = new Subsets(verse_word_counts);

        subsets.Find(number_of_verses, number_of_words, OnFound);

        return(m_subsets);
    }
コード例 #4
0
    public List <List <Word> > Find(int number_of_words, int number_of_letters)
    {
        m_subsets = new List <List <Word> >();

        long[] word_lengths = new long[m_items.Count];
        for (int i = 0; i < m_items.Count; i++)
        {
            string simplified_word_text = m_items[i].Text;
            if (m_items[i].Text.IsArabicWithDiacritics())
            {
                simplified_word_text = simplified_word_text.Simplify29();
            }
            word_lengths[i] = simplified_word_text.Length;
        }

        Subsets subsets = new Subsets(word_lengths);

        subsets.Find(number_of_words, number_of_letters, OnFound);

        return(m_subsets);
    }
コード例 #5
0
ファイル: Subsets.cs プロジェクト: jeason0813/QuranCode
    private static void Main(string[] args)
    {
        long[] numbers = new long[]
        {
            7, 286, 200, 176, 120, 165, 206, 75, 129, 109,
            123, 111, 43, 52, 99, 128, 111, 110, 98, 135,
            112, 78, 118, 64, 77, 227, 93, 88, 69, 60,
            34, 30, 73, 54, 45, 83, 182, 88, 75, 85,
            54, 53, 89, 59, 37, 35, 38, 29, 18, 45,
            60, 49, 62, 55, 78, 96, 29, 22, 24, 13,
            14, 11, 11, 18, 12, 12, 30, 52, 52, 44,
            28, 28, 20, 56, 40, 31, 50, 40, 46, 42,
            29, 19, 36, 25, 22, 17, 19, 26, 30, 20,
            15, 21, 11, 8, 8, 19, 5, 8, 8, 11,
            11, 8, 3, 9, 5, 4, 7, 3, 6, 3,
            5, 4, 5, 6
        };
        Subsets subsets = new Subsets(numbers);

        int  count = 7;
        long sum   = 313;

        if (args.Length == 2)
        {
            int.TryParse(args[0], out count);
            long.TryParse(args[1], out sum);
        }

        Stopwatch stopwatch = Stopwatch.StartNew();

        m_subset_count = 0L;
        subsets.Find(count, sum, OnSubsetFound);
        stopwatch.Stop();
        Console.WriteLine("Subsets found: " + m_subset_count);
        Console.WriteLine(stopwatch.Elapsed);

        Console.ReadKey();
    }