結果

問題 No.457 (^^*)
ユーザー kuuso1kuuso1
提出日時 2016-12-08 23:00:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 1,628 bytes
コンパイル時間 991 ms
コンパイル使用メモリ 114,848 KB
実行使用メモリ 26,108 KB
最終ジャッジ日時 2024-05-06 09:46:15
合計ジャッジ時間 4,191 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,980 KB
testcase_01 AC 26 ms
23,908 KB
testcase_02 AC 26 ms
23,912 KB
testcase_03 AC 25 ms
21,808 KB
testcase_04 AC 26 ms
23,600 KB
testcase_05 AC 26 ms
23,784 KB
testcase_06 AC 26 ms
25,620 KB
testcase_07 AC 26 ms
23,648 KB
testcase_08 AC 28 ms
23,976 KB
testcase_09 AC 34 ms
23,860 KB
testcase_10 AC 96 ms
23,652 KB
testcase_11 AC 333 ms
26,100 KB
testcase_12 AC 411 ms
25,980 KB
testcase_13 AC 234 ms
23,776 KB
testcase_14 AC 235 ms
26,108 KB
testcase_15 AC 411 ms
23,904 KB
testcase_16 AC 236 ms
21,944 KB
testcase_17 AC 233 ms
23,900 KB
testcase_18 AC 25 ms
23,904 KB
testcase_19 AC 25 ms
25,620 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.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] Ans = new int[2];
		for(int t=0;t<2;t++){
			String s = S[t];
			int N = s.Length;
			for(int i=0;i<N;i++){
				if(s[i] != '(') continue;
				bool[] dp = new bool[5];
				for(int j=i;j<N;j++){
					switch(s[j]){
						case '(':dp[0] = true; break;
						case '^':dp[2] = dp[1];dp[1] = dp[0]; break;
						case '*':dp[3] = dp[2]; break;
						case ')':dp[4] = dp[3]; break;
						default: break;
					}
					if(s[j] ==')' && dp[4]){
						Ans[t]++;
					}
				}
			}
		}
		Console.WriteLine(String.Join(" ",Ans));
	}
	String[] S;
	public Sol(){
		S = new String[2];
		S[0] = rs();
		var ca = S[0].ToCharArray();
		Array.Reverse(ca);
		for(int i=0;i<ca.Length;i++){
			if(ca[i] == '(') ca[i] = ')';
			else if(ca[i] == ')') ca[i] = '(';
		}
		S[1] = new String(ca);
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0