結果

問題 No.457 (^^*)
ユーザー kuuso1
提出日時 2016-12-08 23:00:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 410 ms / 2,000 ms
コード長 1,628 bytes
コンパイル時間 2,732 ms
コンパイル使用メモリ 108,928 KB
実行使用メモリ 18,304 KB
最終ジャッジ日時 2024-11-28 15:33:18
合計ジャッジ時間 5,958 ms
ジャッジサーバーID
(参考情報)
judge3 / 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.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));}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0