結果

問題 No.457 (^^*)
ユーザー butsurizuki
提出日時 2016-11-02 16:55:23
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 432 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 21,376 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-28 04:10:47
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%s",s);
      |         ^~~~~~~~~~~~~

ソースコード

diff #

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

int main(void) {
	int a = 0,b = 0,l,i,j,ca,cb;
	char s[16384],sa[8] = "^^*-",sb[8] = "*^^-";
	scanf("%s",s);
	l = strlen(s);
	for(i = 0;i < l;i++){
		if(s[i] != '('){continue;}
		ca = 0;cb = 0;
		for(j = i + 1;j < l;j++){
			if(s[j] == sa[ca]){ca++;}
			if(s[j] == sb[cb]){cb++;}
			if(s[j] == ')'){
				if(ca >= 3){a++;}
				if(cb >= 3){b++;}
			}
		}
	}
	printf("%d %d\n",a,b);
	return 0;
}
0