結果

問題 No.457 (^^*)
ユーザー mban
提出日時 2016-12-30 22:16:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 345 ms / 2,000 ms
コード長 1,672 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 103,936 KB
実行使用メモリ 17,536 KB
最終ジャッジ日時 2024-12-16 04:14:32
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static string S = Console.ReadLine();
    const string Right="*^^";
    const string Left = "^^*";
    static void Main()
    {
        int R = 0;
        int L = 0;
        for(int i = 0; i < S.Length; i++)
        {
            if (S[i] == '(')
            {
                int lcnt = 0;int rcnt = 0;
                bool l = false, r = false;
                for(int j = i + 1; j < S.Length; j++)
                {
                    if (rcnt == 3)
                    {
                        r = true;
                    }
                    else
                    {
                        if (S[j] == Right[rcnt])
                        {
                            rcnt++;
                        }
                    }
                    if (lcnt == 3)
                    {
                        l = true;
                    }
                    else
                    {
                        if (S[j] ==Left[lcnt])
                        {
                            lcnt++;
                        }
                    }
                    if (S[j] == ')')
                    {
                        if (r)
                        {
                            R++;
                        }
                        if (l)
                        {
                            L++;
                        }
                    }
                }
            }
        }
        Console.WriteLine("{0} {1}", L, R);
    }
}

0