Submission #52692
ソースコード
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 | #include<iostream> #include<algorithm> using namespace std; int i[55][55]; int now1,now2; int e=0; void donotstop( int n){ if (n==1){ while (1){ if (i[now1-1][now2]!=1){ now1=now1-1; if (i[now1][now2]==3) i[now1][now2]=0,e++; } else break ; } } if (n==2){ while (1){ if (i[now1+1][now2]!=1){ now1=now1+1; if (i[now1][now2]==3) i[now1][now2]=0,e++; } else break ; } } if (n==3){ while (1){ if (i[now1][now2+1]!=1){ now2=now2+1; if (i[now1][now2]==3) i[now1][now2]=0,e++; } else break ; } } if (n==4){ while (1){ if (i[now1][now2-1]!=1){ now2=now2-1; if (i[now1][now2]==3) i[now1][now2]=0,e++; } else break ; } } } int main(){ cin.tie(0); ios::sync_with_stdio( false ); int a,b,c,d,f; cin >>a>>b; for ( int n=0;n<a;n++){ for ( int m=0;m<b;m++){ cin >>i[n][m]; if (i[n][m]==4) now1=n,now2=m; } } cin >>a; for ( int n=0;n<a;n++){ cin >>b; donotstop(b); } cout <<e<< '\n' ; return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0387 - 回れ雛月花 -Easy |
ユーザー名 | ei1923 |
投稿日時 | 2019-08-09 12:08:51 |
言語 | C++ |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 1091 Byte |
最大実行時間 | 33 ms |
最大メモリ使用量 | 688 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
spin_input01 | AC | 33 ms | 604 KB |
1
|
spin_input02 | AC | 24 ms | 688 KB |
1
|
spin_input03 | AC | 21 ms | 516 KB |
1
|
spin_input04 | AC | 25 ms | 604 KB |
1
|
spin_input05 | AC | 23 ms | 548 KB |
1
|