結果
問題 | No.659 徘徊迷路 |
ユーザー | tails |
提出日時 | 2018-03-03 00:14:43 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 926 bytes |
コンパイル時間 | 496 ms |
コンパイル使用メモリ | 31,360 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 00:39:40 |
合計ジャッジ時間 | 1,757 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
6,816 KB |
testcase_01 | AC | 16 ms
6,940 KB |
testcase_02 | AC | 46 ms
6,940 KB |
testcase_03 | AC | 46 ms
6,940 KB |
testcase_04 | AC | 46 ms
6,940 KB |
testcase_05 | AC | 8 ms
6,944 KB |
testcase_06 | AC | 12 ms
6,944 KB |
testcase_07 | AC | 12 ms
6,940 KB |
testcase_08 | AC | 19 ms
6,944 KB |
testcase_09 | AC | 50 ms
6,944 KB |
testcase_10 | AC | 53 ms
6,940 KB |
testcase_11 | AC | 54 ms
6,940 KB |
testcase_12 | AC | 9 ms
6,944 KB |
testcase_13 | AC | 46 ms
6,940 KB |
testcase_14 | AC | 46 ms
6,940 KB |
testcase_15 | AC | 56 ms
6,944 KB |
testcase_16 | AC | 54 ms
6,940 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | r;c;t; | ^ main.c:1:1: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | r;c;t; | ^ main.c:1:3: warning: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | r;c;t; | ^ main.c:1:5: warning: type defaults to 'int' in declaration of 't' [-Wimplicit-int] main.c:2:1: warning: data definition has no type or storage class 2 | sy;sx; | ^~ main.c:2:1: warning: type defaults to 'int' in declaration of 'sy' [-Wimplicit-int] main.c:2:4: warning: data definition has no type or storage class 2 | sy;sx; | ^~ main.c:2:4: warning: type defaults to 'int' in declaration of 'sx' [-Wimplicit-int] main.c:3:1: warning: data definition has no type or storage class 3 | gy;gx; | ^~ main.c:3:1: warning: type defaults to 'int' in declaration of 'gy' [-Wimplicit-int] main.c:3:4: warning: data definition has no type or storage class 3 | gy;gx; | ^~ main.c:3:4: warning: type defaults to 'int' in declaration of 'gx' [-Wimplicit-int] main.c:7:1: warning: data definition has no type or storage class 7 | y;x;v;u;j;i; | ^ main.c:7:1: warning: type defaults to 'int' in declaration of 'y' [-Wimplicit-int] main.c:7:3: warning: data definition has no type or storage class 7 | y;x;v;u;j;i; | ^ main.c:7:3: warning: type defaults to 'int' in declaration of 'x' [-Wimplicit-int] main.c:7:5: warning: data definition has no type or storage class 7 | y;x;v;u;j;i; | ^ main.c:7:5: warning: type defaults to 'int' in declaration of 'v' [-Wimplicit-int] main.c:7:7: warning: data definition has no type or storage class 7 | y;x;v;u;j;i; | ^ main.c:7:7: warning: type defaults to 'int' in declaration of 'u' [-Wimplicit-int] main.c:7:9: warning: data defi
ソースコード
r;c;t; sy;sx; gy;gx; char b[10][12]; typedef double mtx[100][100]; mtx m,n,e; y;x;v;u;j;i; mul(mtx a){ memcpy(n,m,sizeof n); for(y=0;y<100;++y){ for(v=0;v<100;++v){ m[y][v]=0; for(j=0;j<100;++j){ m[y][v]+=n[y][j]*a[j][v]; } } } } f(l){ if(l>1){ f(l>>1); mul(n); } if(l&1){ mul(e); } } main(){ scanf("%d%d%d ",&r,&c,&t); scanf("%d%d ",&sy,&sx); scanf("%d%d ",&gy,&gx); for(y=0;y<r;++y){ gets(b[y]); } for(y=1;y<r-1;++y){ for(x=1;x<c-1;++x){ int k=0; k+=b[y-1][x]=='.'; k+=b[y+1][x]=='.'; k+=b[y][x-1]=='.'; k+=b[y][x+1]=='.'; if(k){ double p=1./k; if(b[y-1][x]=='.') e[y*10+x][(y-1)*10+x]=p; if(b[y+1][x]=='.') e[y*10+x][(y+1)*10+x]=p; if(b[y][x-1]=='.') e[y*10+x][y*10+(x-1)]=p; if(b[y][x+1]=='.') e[y*10+x][y*10+(x+1)]=p; }else{ e[y*10+x][y*10+x]=1; } m[y*10+x][y*10+x]=1; } } f(t); printf("%.9f\n",m[sy*10+sx][gy*10+gx]); }