結果

問題 No.457 (^^*)
ユーザー YamyukiYamyuki
提出日時 2016-12-08 00:42:42
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 666 bytes
コンパイル時間 1,244 ms
コンパイル使用メモリ 25,016 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-18 20:54:58
合計ジャッジ時間 1,744 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,384 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 8 ms
4,380 KB
testcase_11 AC 31 ms
4,380 KB
testcase_12 AC 76 ms
4,380 KB
testcase_13 AC 140 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 105 ms
4,380 KB
testcase_16 AC 135 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>


int main(){
	int i,l,a[2],j,rf,lf;
	long right,left;
	char c[10001];
	scanf("%s",c);
	l=strlen(c);
	right=0;
	left=0;
	for(i=0;i<l-1;i++){
		if(c[i]=='('){
			a[0]=0;
			a[1]=-1;
			lf=0;
			rf=0;
			for(j=i+1;j<l;j++){
				if(lf==0){
					if(c[j]=='^'){
						a[0]++;
					}else if(c[j]=='*'){
						if(a[0]>1){
							lf=1;
						}
					}
				}
				if(rf==0){
					if(a[1]==-1){
						if(c[j]=='*'){
							a[1]=0;
						}
					}else if(c[j]=='^'){
						a[1]++;
						if(a[1]>1) rf=1;
					}
				}
				if(c[j]==')'){
					left+=(long)lf;
					right+=(long)rf;
				}
			}
		}
	}
	printf("%ld %ld\n",left,right);
	return 0;
}
0