結果

問題 No.457 (^^*)
ユーザー kuuso1kuuso1
提出日時 2016-12-08 23:00:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 425 ms / 2,000 ms
コード長 1,628 bytes
コンパイル時間 2,457 ms
コンパイル使用メモリ 109,988 KB
実行使用メモリ 22,532 KB
最終ジャッジ日時 2023-08-19 02:36:53
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
20,340 KB
testcase_01 AC 49 ms
20,648 KB
testcase_02 AC 47 ms
22,484 KB
testcase_03 AC 46 ms
20,360 KB
testcase_04 AC 47 ms
20,576 KB
testcase_05 AC 47 ms
18,272 KB
testcase_06 AC 47 ms
20,540 KB
testcase_07 AC 46 ms
18,280 KB
testcase_08 AC 49 ms
20,504 KB
testcase_09 AC 55 ms
22,476 KB
testcase_10 AC 113 ms
20,488 KB
testcase_11 AC 332 ms
22,372 KB
testcase_12 AC 425 ms
20,404 KB
testcase_13 AC 271 ms
20,468 KB
testcase_14 AC 273 ms
20,384 KB
testcase_15 AC 423 ms
20,492 KB
testcase_16 AC 272 ms
18,284 KB
testcase_17 AC 259 ms
22,532 KB
testcase_18 AC 50 ms
20,432 KB
testcase_19 AC 49 ms
20,580 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