Exemple #1
0
        private SortedDictionary <string, que_ans> initializationAnswer(ref int count)
        {
            SortedDictionary <string, que_ans> ans = new SortedDictionary <string, que_ans>();
            int ctmp = 0;

            System.IO.StringReader ra = new System.IO.StringReader(
                Properties.Resources.tiku_txt);

            for (string i; (i = ra.ReadLine()) != null;)
            {
                string[] strs = i.Split(',');
                int      nums;
                if (!int.TryParse(strs[1], out nums))
                {
                    throw new Exception();
                }

                que_ans tmpans = new que_ans();
                tmpans.num     = nums;
                tmpans.anslist = new int[nums];
                for (int j = 0; j < nums; j++)
                {
                    if (!int.TryParse(strs[2 + j], out tmpans.anslist[j]))
                    {
                        throw new Exception();
                    }
                }
                ans.Add(strs[0], tmpans);
                ctmp++;
            }
            count    = ctmp;
            ansReady = true;
            return(ans);
        }
Exemple #2
0
        private SortedDictionary<string, que_ans> initializationAnswer(ref int count)
        {
            SortedDictionary<string, que_ans> ans = new SortedDictionary<string, que_ans>();
            int ctmp = 0;

            System.IO.StringReader ra = new System.IO.StringReader(
                Properties.Resources.tiku_txt);

            for (string i; (i = ra.ReadLine()) != null; )
            {
                string[] strs = i.Split(',');
                int nums;
                if(!int.TryParse(strs[1], out nums))
                    throw new Exception();

                que_ans tmpans = new que_ans();
                tmpans.num=nums;
                tmpans.anslist = new int[nums];
                for (int j = 0; j < nums; j++)
                {
                    if (!int.TryParse(strs[2+j], out tmpans.anslist[j]))
                        throw new Exception();
                }
                ans.Add(strs[0], tmpans);
                ctmp++;
            }
            count = ctmp;
            ansReady = true;
            return ans;
        }