結果

問題 No.457 (^^*)
コンテスト
ユーザー testestest
提出日時 2016-12-31 12:01:38
言語 C90
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 420 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 163 ms
コンパイル使用メモリ 36,024 KB
最終ジャッジ日時 2026-02-24 00:02:26
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | dpL[4],dpR[4];
      | ^~~
main.c:3:1: warning: data definition has no type or storage class
    3 | i,L,R;
      | ^
main.c: In function 'main':
main.c:26:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   26 |         printf("%d %d",L,R);
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | char s[10010];
/usr/bin/ld: /tmp/ccZcNYZ6.o: in function `main':
main.c:(.text.startup+0x18): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

char s[10010];
dpL[4],dpR[4];
i,L,R;
main(){
	gets(s);
	for(i=0;s[i];i++){
		switch(s[i]){
			case '(':
				dpL[0]++;
				dpR[0]++;
				break;
			case '^':
				dpL[2]+=dpL[1];dpL[1]=dpL[0];dpL[0]=0;
				dpR[3]+=dpR[2];dpR[2]=dpR[1];dpR[1]=0;
				break;
			case '*':
				dpL[3]+=dpL[2];dpL[2]=0;
				dpR[1]+=dpR[0];dpR[0]=0;
				break;
			case ')':
				L+=dpL[3];
				R+=dpR[3];

		}
	}
	printf("%d %d",L,R);
	return 0;
}
0