This commit is contained in:
James 2020-04-04 10:37:59 +08:00
parent de4716ac0b
commit e32b5e9ec0
15 changed files with 160 additions and 0 deletions

2
4072_fire/Readme.md Normal file
View File

@ -0,0 +1,2 @@
# 标题

13
4072_fire/ce.cpp Normal file
View File

@ -0,0 +1,13 @@
#include<iostream>
#include<cstring>
using namespace std;
int main(){
char a;
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
cin>>a;
cout<<a;
}
cout<<endl;
}
}

BIN
4072_fire/ce.exe Normal file

Binary file not shown.

4
4072_fire/doc/Readme.md Normal file
View File

@ -0,0 +1,4 @@
# 标题
*
............B.........C.........CC.R.......CCC.........C.........L..............

BIN
4072_fire/doc/灭火.pdf Normal file

Binary file not shown.

36
4072_fire/fire.cpp Normal file
View File

@ -0,0 +1,36 @@
#include<iostream>//YOUWU
#include<cstring>
using namespace std;
int x[100000001]={0},y[100000001]={0},f[100000001]={0},fx[4]={0,0,1,-1},fy[4]={1,-1,0,0};
int main(){
char s[10][10];
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
cin>>s[i][j];
int u=s[i][j];
if(u=='L'){
x[1]=i,y[1]=j;
//cout<<endl<<x[1]<<y[1]<<endl;
}
}
}
int t=0,w=1;
do{
t++;
for(int i=0;i<4;i++){
int nx=x[t]+fx[i],ny=y[t]+fy[i];
//cout<<nx<<" "<<ny<<" "<<s[nx][ny]<<endl;
if(nx>=0&&nx<10&&ny>=0&&ny<10){
if(s[nx][ny]=='B'){
cout<<f[t];
return 0;
}
if(s[nx][ny]!='R'){
x[++w]=nx;
y[w]=ny;
f[w]=f[t]+1;
}
}
}
}while(t<w);
}

BIN
4072_fire/fire.exe Normal file

Binary file not shown.

51
4072_fire/fire2.cpp Normal file
View File

@ -0,0 +1,51 @@
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
char s[10][10];
int b[2],l[2],r[2],ans=0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
cin >> s[i][j];
int u = s[i][j];
if (u == 'L') {
l[0] = i, l[1] = j;
}
if (u == 'B') {
b[0] = i, b[1] = j;
}
if (u == 'R') {
r[0] = i, r[1] = j;
}
}
}
int t=b[1],w=l[1];
if(t>w){
int e=t;
t=w;
w=e;
}
if(l[0]==b[0]&&b[0]==r[0]){
if(r[1]>t&&r[1]<w){
ans+=2;
}
}
t=b[0],w=l[0];
if(t>w){
int e=t;
t=w;
w=e;
}
if(l[1]==b[1]&&b[1]==r[1]){
if(r[0]>t&&r[0]<w){
ans+=2;
}
}
int ax=b[0]-l[0];
int bx=b[1]-l[1];
if(ax<0) ax*=-1;
if(bx<0) bx*=-1;
ans=ans+ax+bx-1;
cout<<ans;
}

BIN
4072_fire/fire2.exe Normal file

Binary file not shown.

6
4072_fire/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include <iostream>
int main()
{
std::cout << "Hello Easy C++ project!" << std::endl;
}

BIN
4072_fire/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,10 @@
..........
..........
..........
..........
..........
..........
..........
.........L
..........
R........B

View File

@ -0,0 +1,10 @@
..........
..........
....L.....
..........
..........
....R.....
..........
..........
....B.....
..........

10
4072_fire/test/in.txt Normal file
View File

@ -0,0 +1,10 @@
..........
..........
..........
.....B....
..........
.....R....
..........
..........
.....L....
..........

18
4072_fire/test/out.txt Normal file
View File

@ -0,0 +1,18 @@
## z:\Chao\src\4072_fire\test\in.txt
2020/04/04 ÖÜÁù 9:52:10.18
6
-----------------------------------------------
Process exited after 160 ms with return value 0
## z:\Chao\src\4072_fire\test\In1 (14).txt
2020/04/04 ÖÜÁù 9:52:10.18
1
-----------------------------------------------
Process exited after 110 ms with return value 0
## z:\Chao\src\4072_fire\test\In2 (6).txt
2020/04/04 ÖÜÁù 9:52:10.18
7
-----------------------------------------------
Process exited after 80 ms with return value 0