Esempio n. 1
0
        private static ChallengeInfo ParseOneCppChallenge(string infoString, int challengeIndex, ref int readPointer)
        {
            var index   = infoString.IndexOf('$', readPointer);
            var contest = infoString.Substring(readPointer, index - readPointer);

            readPointer = index + 1;
            index       = infoString.IndexOf('<', readPointer);
            var name = infoString.Substring(readPointer, index - readPointer);

            readPointer = index + 1;
            index       = infoString.IndexOf('>', readPointer);
            var uri = infoString.Substring(readPointer, index - readPointer);

            readPointer = index + 1;
            index       = infoString.IndexOf('$', readPointer);
            var input = ChallengeClass.CppStringToCs(infoString.Substring(readPointer, index - readPointer));

            readPointer = index + 1;
            index       = infoString.IndexOf('$', readPointer);
            var output = ChallengeClass.CppStringToCs(infoString.Substring(readPointer, index - readPointer));

            readPointer = index + 1;
            IChallenge newChallenge = new CppChallenge(challengeIndex, input, output);

            return(new ChallengeInfo(name, contest, newChallenge, new Uri(uri)));
        }
Esempio n. 2
0
        public void Solve()
        {
            var input = ChallengeClass.CsStringToCpp(Console.In.ReadToEnd());
            var ret   = ChallengeClass.CppStringToCs(RunSolver(_index, input));

            if (ret == "<<<EXCEPTION>>>")
            {
                throw new InvalidOperationException("C++ program threw an exception");
            }
            Console.Write(ret);
        }