-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3.cpp
More file actions
98 lines (96 loc) · 2.74 KB
/
3.cpp
File metadata and controls
98 lines (96 loc) · 2.74 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <bits/stdc++.h>
using namespace std;
int a[11][11], b[11][11], c[11][11], d[11][11], e[11][11];
int putin(int a[][11], int x, int y)
{
int ans=0;
for (int i = 1; i <= x; i++)
{
string s;
cin >> s;
for (int j = 0; j < s.size(); j++)
{
if(s[j] == '#')
a[i][j + 1] = 1,ans++;
}
}
return ans;
}
void setd()
{
for (int i = 1; i <= 10; i++)
for (int j = 1; j <= 10; j++)
{
d[i][j] = a[i][j];
}
}
void sete()
{
for (int i = 1; i <= 10; i++)
for (int j = 1; j <= 10; j++)
{
e[i][j] = d[i][j];
}
}
int ax, ay, bx, by, cx, cy;
int main()
{
int ans=0,ans2=0;//计数
cin >> ax >> ay;
ans+=putin(a, ax, ay);
cin >> bx >> by;
ans+=putin(b, bx, by);
cin >> cx >> cy;
ans2+=putin(c, cx, cy);
for (int I = 2 - 10; I <= 10; I++)
for (int J = 2 - 10; J <= 10; J++) // 启动位置
{
int ans1 = ans;
setd();
for (int i = I, _i = 1; i < I + 10; i++, _i++) // 注意矩阵叠加问题,找了许久
for (int j = J, _j = 1; j < J + 10; j++, _j++)
{
if (i >= 1 && j >= 1 && i <= 10 && j <= 10)
{
d[i][j] += b[_i][_j];
if (d[i][j] > 1)
{
ans1--;
d[i][j] = 1;
}
}
}
for (int I_ = 2 - 10; I_ <= 10; I_++)
for (int J_ = 2 - 10; J_ <= 10; J_++) // 比较矩阵启动位置
{
bool tag = 1;
sete();
for (int i = I_, _i = 1; i < I_ + 10; i++, _i++)
for (int j = J_, _j = 1; j < J_ + 10; j++, _j++)
{
if (i >= 1 && j >= 1 && i <= 10 && j <= 10)
{
e[i][j] += c[_i][_j];
}
}
for (int i = 1; i <= 10; i++)
for (int j = 1; j <= 10; j++)
{
if (e[i][j] != 2 * d[i][j])
{
tag = 0;
break;
}
}
if (tag&&ans1==ans2)
{
cout << "Yes" << endl;
system("pause");
return 0;
}
}
}
cout << "No" << endl;
system("pause");
return 0;
}