This commit is contained in:
parent
887df2c224
commit
1ca2eb288f
10
input.txt
10
input.txt
|
@ -1,5 +1,5 @@
|
|||
xxx xxxxxxxx xxxxxxxxxxxxxxxx
|
||||
x x x x xx xx x xx xx x x
|
||||
x x xxxxxxxxxxxxxxxx xxxxxxxxxxxxx
|
||||
x x xx x x xx x xx x x x
|
||||
xxx xxxxxxx xxxxxxx xxxxxxx
|
||||
xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx
|
||||
x x x x x x x x x x x x x x x x x x x x x
|
||||
xxx x xxx xxx x x xxx xxx xxx xxx xxx xxx xxx x x x xxx x xxx
|
||||
x x x x x x x x x x x x x x x x x x x
|
||||
xxx x xxx xxx xxx xxx xxx xxx x xxx x xxx
|
||||
|
|
124
solver.cpp
124
solver.cpp
|
@ -4,18 +4,134 @@ using namespace std;
|
|||
|
||||
string datas[5];
|
||||
int data[5][256];
|
||||
int models[12][5][5]={
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,0,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,0,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,0,0},
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,0,0},
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,0,0,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,1,1,1,0},
|
||||
{0,1,0,1,0},
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,1,0},
|
||||
{0,1,1,1,0}
|
||||
},
|
||||
{
|
||||
{0,0,0,0,0},
|
||||
{0,0,1,0,0},
|
||||
{0,1,1,1,0},
|
||||
{0,0,1,0,0},
|
||||
{0,0,0,0,0}
|
||||
},
|
||||
{
|
||||
{0,0,0,0,0},
|
||||
{0,0,0,0,0},
|
||||
{0,1,1,1,0},
|
||||
{0,0,0,0,0},
|
||||
{0,0,0,0,0}
|
||||
}
|
||||
};
|
||||
|
||||
int rec(int x,int y){
|
||||
for(int i=0;i<5;i++){
|
||||
for(int j=-1;j<=3;j++){
|
||||
if(data[i][x+j] != models[y][i][j+1]) return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(){
|
||||
freopen("input.txt","r",stdin);
|
||||
string s = "";
|
||||
for(int i=0;i<5;i++){
|
||||
cin >> datas[i];
|
||||
getline(cin,datas[i]);
|
||||
data[i][0]=0;
|
||||
datas[i]+=" ";
|
||||
}
|
||||
for(int i=0;i<5;i++){
|
||||
for (int j=0;j<datas[i].size();j++){
|
||||
if(datas[i][j] == 'x') data[i][j]=1;
|
||||
for (int j=1;j<=datas[i].size();j++){
|
||||
if(datas[i][j-1] == 'x') data[i][j]=1;
|
||||
else data[i][j]=0;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=1;i<=datas[0].size()-4;i++){
|
||||
if(data[0][i] == 0 && data[0][i+1] == 0 && data[0][i+2] == 0){
|
||||
if(rec(i,10)){
|
||||
s+="+";
|
||||
}
|
||||
else if(rec(i,11)){
|
||||
s+="-";
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int k=0;k<10;k++){
|
||||
if(rec(i,k)){
|
||||
s+=k+'0';
|
||||
i+=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cout << s;
|
||||
return 0;
|
||||
}
|
Binary file not shown.
|
@ -1,25 +1 @@
|
|||
// for(int i=0;i<=10;i++){
|
||||
// if(i%2==1){
|
||||
// int signx = randn(1,2);
|
||||
// for(int j=0;j<5;j++){
|
||||
// datas[j]+=sign[signx-1][j];
|
||||
// }
|
||||
// int space = randn(1,6);
|
||||
// for(int j=0;j<5;j++){
|
||||
// for(int k=0;k<space;k++) datas[j] += " ";
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// int num = randn(1,100);
|
||||
// string s = sstr(num);
|
||||
// for(int j=0;j<s.size();j++){
|
||||
// for(int k=0;k<5;k++){
|
||||
// datas[k] += numbers[s[j]-'0'][k];
|
||||
// }
|
||||
// int space = randn(1,6);
|
||||
// for(int x=0;x<5;x++){
|
||||
// for(int k=0;k<space;k++) datas[x] += " ";
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return 0;
|
Loading…
Reference in New Issue