#include<iostream>
using namespace std;
void fm (int arry[10][14],int center_s[10]);
void main()
{
int center_s[10];
int arry[10][14]={
0,0,0,255,255,255,255,255,255,255,255,255,255,255,
255,0,0,0,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,0,0,0,255,255,255,255,255,255,255,255,255,255,
0,0,0,255,255,255,255,255,255,255,255,255,255,255,
0,0,0,255,255,255,255,255,255,255,255,255,255,255,
/* 255,255,255,255,255,255,255,255,255,0,0,0,255,255,
255,255,255,255,255,255,255,255,0,0,0,255,255,255,
255,255,255,255,255,255,255,0,0,0,255,255,255,255,
255,255,255,255,255,255,0,0,0,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,255,255,255,255,255,255,255,255,
255,255,255,255,255,255,0,0,0,255,255,255,255,255,
255,255,255,255,255,255,255,0,0,0,255,255,255,255,*/
};
fm (arry,center_s);
}
void fm(int arry[10][14], int center_s[10]) //arry[9][14]为AD转换后的数据,arry1[9]用于储存0的中心位置
{
int s,p,a=0,b=0,adda,addb,j,count,linea,lineb,jj;
for(int i=0;i<10;i++) //用arry1[9]记录每一行的0中心位置
{
s=0,p=0;
for(int j=0;j<14;j++)
{
if(arry[i][j]==0)
{
s+=j;
p++;
}
}
if(p!=0)
center_s[i]=s/p; //总位置和s除去0的总个数p,即为0的中间位置
else
center_s[i]=0;
}
for(j=1;j<11;j++) //确定arry1[9]中的虚线的0中心位置
{
if(center_s[j-1]!=0&¢er_s[j]==0) //用a确定虚线上限
{ a=center_s[j-1];//取出虚线上限零的水平位置
adda=((center_s[j-1]-center_s[0])*2)/j;//求出递增的数值
linea=j-1;
}
if(center_s[j-1]==0&¢er_s[j]!=0) //用b确定虚线下限
{
b=center_s[j];//取出虚线下限零的水平位置
addb=((center_s[j]-center_s[9])*2)/(9-j+1);//求出递增的数值
lineb=j+1;
}
}
if(a!=0&&b!=0) //中间有0
{
cout<<a<<endl;
cout<<b<<endl;
cout<<adda<<endl;
cout<<addb<<endl;
for(j=1;linea+j<lineb;j++)
{
if(lineb-linea-2*j>=2){
center_s[linea+j]=center_s[linea+j-1]+adda;
center_s[lineb-j]=center_s[lineb-j+1]+addb;
}
if(lineb-linea-2*j<=1) {center_s[lineb-j]=center_s[lineb-j+1]+addb; break;}
}
cout<<endl<<endl<<endl;
for(j=0;j<10;j++)
{
if(center_s[j]!=0){
arry[j][center_s[j]]=0;
arry[j][center_s[j]-1]=0;
arry[j][center_s[j]+1]=0;}
}
}
for ( int d=0; d < 10; d++)
{
for ( int f=0; f < 14; f++)
{
cout<<arry[d][f]<<" ";
}
cout<<endl;
}
}