結果
問題 | No.436 ccw |
ユーザー |
![]() |
提出日時 | 2016-10-29 16:27:44 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 375 bytes |
コンパイル時間 | 741 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-24 18:01:54 |
合計ジャッジ時間 | 783 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:12:11: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] 12 | j=strlen(p); | ^~~~~~ main.c:2:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ 1 | #include <stdio.h> +++ |+#include <string.h> 2 | main.c:12:11: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch] 12 | j=strlen(p); | ^~~~~~ main.c:12:11: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%s",p); | ^~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { char p[100000]; int i=0; int j; int l=0; int u=0; int m=0; scanf("%s",p); j=strlen(p); for(i;i<j;i++){ if(p[i]=='c'){ l++; } } for(j;j-1>=0;j--){ if(p[j]=='w'){ u++; } } if(l<u||l==u){ while(l>=2){ l--; m++; } }else if(l>u){ while(u>=1){ u--; m++; } } printf("%d",m); return 0; }