結果

問題 No.457 (^^*)
ユーザー 👑 testestest
提出日時 2016-12-31 12:01:38
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 19,712 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-16 04:26:48
合計ジャッジ時間 1,089 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | dpL[4],dpR[4];
      | ^~~
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘dpL’ [-Wimplicit-int]
main.c:2:8: warning: type defaults to ‘int’ in declaration of ‘dpR’ [-Wimplicit-int]
    2 | dpL[4],dpR[4];
      |        ^~~
main.c:3:1: warning: data definition has no type or storage class
    3 | i,L,R;
      | ^
main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
main.c:3:3: warning: type defaults to ‘int’ in declaration of ‘L’ [-Wimplicit-int]
    3 | i,L,R;
      |   ^
main.c:3:5: warning: type defaults to ‘int’ in declaration of ‘R’ [-Wimplicit-int]
    3 | i,L,R;
      |     ^
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    4 | main(){
      | ^~~~
main.c: In function ‘main’:
main.c:5:9: warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]
    5 |         gets(s);
      |         ^~~~
main.c:26:9: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   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];
main.c:26:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   26 |         printf("%d %d",L,R);
      |         ^~~~~~
main.c:26:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
/usr/bin/ld: /tmp/ccP0fa8d.o: in function `main':
main.c:(.text.startup+0x1c): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #

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