-
Notifications
You must be signed in to change notification settings - Fork 0
/
201604-2.cpp
66 lines (65 loc) · 892 Bytes
/
201604-2.cpp
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
#include<iostream>
using namespace std;
int main()
{
int n,i,k,j,t,x;
int a[20][11],b[4][4],c[20][11];
for(i=1;i<=15;i++)
{
for(j=1;j<=10;j++)
{
cin>>a[i][j];
c[i][j]=a[i][j];
}
}
for(i=16;i<=19;i++)
{
for(j=1;j<=10;j++)
{
a[i][j]=1;
c[i][j]=a[i][j];
}
}
for(i=1;i<=4;i++)
{
for(j=1;j<=4;j++)
{
cin>>b[i][j];
}
}
cin>>k;
int po=1;
for(i=1;i<=19&&po;i++)
{
po=1;
for(j=4;j>=1&&po&&i+j-4>=1;j--)
{
for(x=1;x<=4&&po;x++)
{
c[i+j-4][k+x-1]=a[i+j-4][k+x-1]+b[j][x];
if(c[i+j-4][k+x-1]>1)
po=0;
}
}
}
i=i-2;
for(j=4;j>=1;j--)
{
for(x=1;x<=4;x++)
{
a[i+j-4][k+x-1]=a[i+j-4][k+x-1]+b[j][x];
}
}
for(i=1;i<=15;i++)
{
for(j=1;j<=10;j++)
{
cout<<a[i][j];
if(j!=10)
cout<<" ";
}
if(i!=15)
cout<<endl;
}
return 0;
}