結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-09 16:19:13 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 189 ms / 2,000 ms |
| コード長 | 424 bytes |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 22,016 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 04:10:49 |
| 合計ジャッジ時間 | 1,631 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:13: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
8 | l = strlen(s);
| ^~~~~~
main.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
2 | #include <stdlib.h>
+++ |+#include <string.h>
3 |
main.c:8:13: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
8 | l = strlen(s);
| ^~~~~~
main.c:8:13: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%s",s);
| ^~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int i,j,l,ap,bp,ac=0,bc=0;
char s[16384],a[8] = "^^*-",b[8] = "*^^-";
scanf("%s",s);
l = strlen(s);
for(i = 0;i < l;i++){
if(s[i] != '('){continue;}
ap=0;bp=0;
for(j = i+1;j < l;j++){
if(s[j] == a[ap]){ap++;}
if(s[j] == b[bp]){bp++;}
if(s[j] == ')'){
if(ap >= 3){ac++;}
if(bp >= 3){bc++;}
}
}
}
printf("%d %d\n",ac,bc);
return 0;
}