Submission #07368
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #include<stdio.h> int main(){ int h,w,n,i,j,m; int sth,stw; int yaku=0; scanf ( "%d %d" ,&h,&w); int map[h][w]; for (i=0;i<h;i++){ for (j=0;j<w;j++){ scanf ( "%d" ,&map[i][j]); if (map[i][j]==4){ sth=i; // start high stw=j; // start west } } } scanf ( "%d" ,&n); for (i=0;i<n;i++){ scanf ( "%d" ,&m); if (m==1){ // up while (1){ sth--; if (map[sth][stw]==1){ sth++; break ; } if (map[sth][stw]==3){ yaku++; map[sth][stw]=0; } } } if (m==2){ while (1){ // down sth++; if (map[sth][stw]==1){ sth--; break ; } if (map[sth][stw]==3){ yaku++; map[sth][stw]=0; } } } if (m==3){ while (1){ // right stw++; if (map[sth][stw]==1){ stw--; break ; } if (map[sth][stw]==3){ yaku++; map[sth][stw]=0; } } } if (m==4){ // left while (1){ stw--; if (map[sth][stw]==1){ stw++; break ; } if (map[sth][stw]==3){ yaku++; map[sth][stw]=0; } } } } printf ( "%d\n" ,yaku); return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0387 - 回れ雛月花 -Easy |
ユーザー名 | ei1612 |
投稿日時 | 2016-07-22 01:11:27 |
言語 | C |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 1221 Byte |
最大実行時間 | 48 ms |
最大メモリ使用量 | 512 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
spin_input01 | AC | 48 ms | 380 KB |
1
|
spin_input02 | AC | 11 ms | 308 KB |
1
|
spin_input03 | AC | 11 ms | 332 KB |
1
|
spin_input04 | AC | 9 ms | 512 KB |
1
|
spin_input05 | AC | 33 ms | 476 KB |
1
|