結果

問題 No.457 (^^*)
ユーザー nola_suznola_suz
提出日時 2016-12-08 03:38:40
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 425 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 23,396 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-18 20:56:08
合計ジャッジ時間 959 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:2: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
  scanf("%s", s);
  ^~~~~
main.c:6:2: warning: incompatible implicit declaration of built-in function ‘scanf’
main.c:6:2: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:1:1:
+#include <stdio.h>
 char s[10002];
main.c:6:2:
  scanf("%s", s);
  ^~~~~
main.c:25:2: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
  printf("%d %d\n", dp1[4], dp2[4]);
  ^~~~~~
main.c:25:2: warning: incompatible implicit declaration of built-in function ‘printf’
main.c:25:2: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

char s[10002];
int dp1[5];
int dp2[5];
void main(){
	int i;
	scanf("%s", s);
	for(i=0;s[i];i++){
		if(s[i]=='('){
			dp1[0]++;
			dp2[0]++;
		}
		if(s[i]==')'){
			dp1[4]+=dp1[3];
			dp2[4]+=dp2[3];
		}
		if(s[i]=='*'){
			dp1[3]+=dp1[2],dp1[2]=0;
			dp2[1]+=dp2[0],dp2[0]=0;
		}
		if(s[i]=='^'){
			dp1[2]+=dp1[1],dp1[1]=dp1[0],dp1[0]=0;
			dp2[3]+=dp2[2],dp2[2]=dp2[1],dp2[1]=0;
		}
	}
	printf("%d %d\n", dp1[4], dp2[4]);
}
0