結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2016-03-08 03:22:54 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 428 bytes |
コンパイル時間 | 400 ms |
コンパイル使用メモリ | 20,864 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 13:30:19 |
合計ジャッジ時間 | 1,095 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 9 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[101]’ [-Wformat=] 7 | scanf("%s", &mojiretsu); | ~^ ~~~~~~~~~~ | | | | | char (*)[101] | char * main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s", &mojiretsu); | ^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #define JOGEN 100 int main (void) { int i, j, nagasa, hantei = 0; char mojiretsu[(JOGEN + 1)]; scanf("%s", &mojiretsu); for(i = 0; (i < JOGEN) && (hantei < 3); i++) { if(mojiretsu[i] == 'c') { nagasa = 0; hantei = 1; } if( (mojiretsu[i] == 'w') && (hantei > 0) ) { hantei++; } nagasa++; } if(hantei < 3) { printf("-1\n"); } else { printf("%d\n", nagasa); } return 0; }