Submission #52718


ソースコード

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
82
83
#include<bits/stdc++.h>
using namespace std;
signed main(){
int a,b,c,q=0,e,z,x;
int d[100][100];
cin>>a>>b;
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
cin>>d[i][j];
}
}
cin>>e;
for(int i=0;i<e;i++){
for(int j=0;j<a;j++){
for(int k=0;k<b;k++){
if(d[j][k]==4){
z=j;
x=k;
d[j][k]=0;
break;
}
}
}
cin>>c;
if(c==1){
while(true){
z--;
if(d[z][x]==1){
z++;
d[z][x]=4;
break;
}
if(d[z][x]==3){
q++;
d[z][x]=0;
}
}
}
if(c==2){
while(true){
z++;
if(d[z][x]==1){
z--;
d[z][x]=4;
break;
}
if(d[z][x]==3){
q++;
d[z][x]=0;
}
}
}
if(c==3){
while(true){
x++;
if(d[z][x]==1){
x--;
d[z][x]=4;
break;
}
if(d[z][x]==3){
q++;
d[z][x]=0;
}
}
}
if(c==4){
while(true){
x--;
if(d[z][x]==1){
x++;
d[z][x]=4;
break;
}
if(d[z][x]==3){
q++;
d[z][x]=0;
}
}
}
}
cout<<q<<"\n";
}

ステータス

項目 データ
問題 0387 - 回れ雛月花 -Easy
ユーザー名 ei1941
投稿日時 2019-08-10 11:29:48
言語 C++
状態 Accepted
得点 3
ソースコード長 1063 Byte
最大実行時間 25 ms
最大メモリ使用量 604 KB

セット

セット 得点 Cases
1 ALL 3 / 3 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
spin_input01 AC 25 ms 604 KB
1
spin_input02 AC 20 ms 568 KB
1
spin_input03 AC 20 ms 524 KB
1
spin_input04 AC 17 ms 484 KB
1
spin_input05 AC 22 ms 568 KB
1