제출 #20587

#제출 시각아이디문제언어결과실행 시간메모리
20587model_codeLaugh Analysis (IOI16_laugh)C11
100 / 100
0 ms1212 KiB
#include "laugh_c.h" static int max(int a, int b) { return a > b ? a : b; } int longest_laugh(char* s) { int slen = strlen(s); int cur = 0, ans = 0; if (s[0] == 'a' || s[0] == 'h') cur++; for (int i = 1; i < slen; i++) { if ((s[i - 1] == 'a' && s[i] == 'h') || (s[i - 1] == 'h' && s[i] == 'a')) cur++; else { ans = max(ans, cur); cur = 0; if (s[i] == 'a' || s[i] == 'h') cur++; } } ans = max(ans, cur); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

laugh.c: In function 'longest_laugh':
laugh.c:9:16: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     int slen = strlen(s);
                ^
laugh.c:9:16: warning: incompatible implicit declaration of built-in function 'strlen'
laugh.c:9:16: note: include '<string.h>' or provide a declaration of 'strlen'
grader.c: In function 'main':
grader.c:9:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", s);
  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...