Submission #00040
ソースコード
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 | #include<iostream> #include<string> using namespace std; int dy[]={1,0,-1,0}; int dx[]={0,1,0,-1}; int main() { int a,b; int h,w; string point[1005]; cin>>h>>w; for ( int i=0;i<h;i++){ cin>>point[i]; for ( int j=0;j<w;j++){ if (point[i][j]== '@' ){ a=i; b=j; } } } for ( int i=0;i<4;i++) if (a+dy[i]>=0&&a+dy[i]<h){ if (b+dx[i]>=0&&b+dx[i]<w){ point[a+dy[i]][b+dx[i]]= '.' ; } } if (a-1>=0&&b-1>=0) point[a-1][b-1]= '.' ; if (a+1<h&&b-1>=0) point[a+1][b-1]= '.' ; if (a-1>=0&&b+1<w) point[a-1][b+1]= '.' ; if (a+1<h&&b+1<w) point[a+1][b+1]= '.' ; for ( int i=0;i<h;i++){ for ( int j=0;j<w;j++){ cout<<point[i][j]; } cout<< '\n' ; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 0001 - 中華ハゲ |
ユーザー名 | ei1841 |
投稿日時 | 2018-08-22 10:49:42 |
言語 | C++ |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 766 Byte |
最大実行時間 | 26 ms |
最大メモリ使用量 | 600 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.dat | AC | 26 ms | 480 KB |
1
|
in02.dat | AC | 21 ms | 428 KB |
1
|
in03.dat | AC | 20 ms | 376 KB |
1
|
in04.dat | AC | 20 ms | 452 KB |
1
|
in05.dat | AC | 23 ms | 528 KB |
1
|
in06.dat | AC | 21 ms | 600 KB |
1
|