예제 #1
0
 private Problem1(InputParser input)
 {
     Text = input.GetString();
 }
예제 #2
0
파일: 18.cs 프로젝트: qifanyyy/CLCDSA
        public string SolveOneCase(InputParser input)
        {
            R = input.GetInt();
            C = input.GetInt();

            str = new string[R];
            for (int i = 0; i < R; i++)
            {
                str[i] = input.GetString();
            }
            count = 0;

            for (int i = 0; i < R; i++)
            {
                for (int j = 0; j < C; j++)
                {
                    var  c = str[i][j];
                    bool t = navigate(i, j, true, c);
                    if (!t)
                    {
                        if (c != '<')
                        {
                            var x = navigate(i, j, true, '<');
                            if (x)
                            {
                                count++;
                                continue;
                            }
                        }
                        if (c != '^')
                        {
                            var x = navigate(i, j, true, '^');
                            if (x)
                            {
                                count++;
                                continue;
                            }
                        }
                        if (c != '>')
                        {
                            var x = navigate(i, j, true, '>');
                            if (x)
                            {
                                count++;
                                continue;
                            }
                        }
                        if (c != 'v')
                        {
                            var x = navigate(i, j, true, 'v');
                            if (x)
                            {
                                count++;
                                continue;
                            }
                        }
                        return(IMP);
                    }
                }
            }


            return(count.ToString());
        }