結果
問題 |
No.697 池の数はいくつか
|
ユーザー |
![]() |
提出日時 | 2018-06-09 18:13:36 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 885 ms / 6,000 ms |
コード長 | 393 bytes |
コンパイル時間 | 439 ms |
コンパイル使用メモリ | 29,568 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-08 07:36:15 |
合計ジャッジ時間 | 8,060 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class 2 | h,w;r; | ^ main.c:2:1: warning: type defaults to 'int' in declaration of 'h' [-Wimplicit-int] main.c:2:3: warning: type defaults to 'int' in declaration of 'w' [-Wimplicit-int] 2 | h,w;r; | ^ main.c:2:5: warning: data definition has no type or storage class 2 | h,w;r; | ^ main.c:2:5: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int] main.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int] 3 | f(y,x,l,r){ | ^ main.c: In function 'f': main.c:3:1: warning: type of 'y' defaults to 'int' [-Wimplicit-int] main.c:3:1: warning: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:3:1: warning: type of 'l' defaults to 'int' [-Wimplicit-int] main.c:3:1: warning: type of 'r' defaults to 'int' [-Wimplicit-int] main.c: At top level: main.c:12:1: warning: return type defaults to 'int' [-Wimplicit-int] 12 | main(y,x){ | ^~~~ main.c: In function 'main': main.c:12:1: warning: type of 'y' defaults to 'int' [-Wimplicit-int] main.c:12:1: warning: type of 'x' defaults to 'int' [-Wimplicit-int] main.c:13:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 13 | scanf("%d%d",&h,&w); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char a[3010][3010]; main.c:13:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 13 | scanf("%d%d",&h,&w); | ^~~~~ main.c:13:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:27:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 27 | printf("%d",r); | ^~~~~~ main.c:27:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:27:9: warning: incompatible implicit declaration of built-in function 'printf' [-
ソースコード
char a[3010][3010]; h,w;r; f(y,x,l,r){ l=r=x; while(a[y][l-1])a[y][--l]=0; while(a[y][r])a[y][r++]=0; for(x=l;x<r;++x){ if(a[y-1][x])f(y-1,x); if(a[y+1][x])f(y+1,x); } } main(y,x){ scanf("%d%d",&h,&w); for(y=1;y<=h;++y){ for(x=1;x<=w;++x){ scanf("%d",&a[y][x]); } } for(y=1;y<=h;++y){ for(x=1;x<=w;++x){ if(a[y][x]){ ++r; f(y,x); } } } printf("%d",r); }