結果

問題 No.457 (^^*)
ユーザー taba
提出日時 2017-05-18 06:38:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 631 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 70,504 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-18 18:15:35
合計ジャッジ時間 4,308 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>

using namespace std;
int main(){
	char s[10001];
	-scanf("%s",s);
	int end=0,count[]={0,0};
	while(s[end])end++;
	for(int a=0;a<end;a++){
		if(s[a]=='('){
			for(int e=a;e<end;e++){
				if(s[e]==')'){
					char left[]="^^*",right[]="*^^",lc=0,rc=0;
					for(int b=a;b<e&&(lc<3||rc<3);b++){
						if(s[b]==left[lc])lc++;
						if(s[b]==right[rc])rc++;
					}
					if(lc==3)count[0]++;
					if(rc==3)count[1]++;
				}
			}
		}
	}
	printf("%d %d\n",count[0],count[1]);
	return 0;
}
0