結果

問題 No.457 (^^*)
ユーザー mbanmban
提出日時 2016-12-30 22:16:58
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 1,672 bytes
コンパイル時間 2,751 ms
コンパイル使用メモリ 100,820 KB
実行使用メモリ 24,752 KB
最終ジャッジ日時 2023-08-22 08:37:52
合計ジャッジ時間 5,946 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
18,516 KB
testcase_01 AC 54 ms
22,660 KB
testcase_02 AC 53 ms
20,696 KB
testcase_03 AC 54 ms
20,552 KB
testcase_04 AC 53 ms
20,628 KB
testcase_05 AC 53 ms
20,700 KB
testcase_06 AC 53 ms
20,724 KB
testcase_07 AC 54 ms
20,692 KB
testcase_08 AC 54 ms
20,676 KB
testcase_09 AC 56 ms
22,804 KB
testcase_10 AC 69 ms
20,576 KB
testcase_11 AC 116 ms
18,568 KB
testcase_12 AC 295 ms
20,652 KB
testcase_13 AC 412 ms
22,804 KB
testcase_14 AC 55 ms
24,752 KB
testcase_15 AC 305 ms
20,744 KB
testcase_16 AC 419 ms
22,700 KB
testcase_17 AC 54 ms
20,684 KB
testcase_18 AC 53 ms
22,600 KB
testcase_19 AC 53 ms
20,740 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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