#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define n 20
using namespace std;
typedef long long ll;
typedef vector<int>vi;
vector< vi >v;
int main()
{
// READ;
// freopen("output.txt","w",stdout);
int test;
sc(test);
int ary[100];
while(test--)
{
v.assign(n,vi());
for(int i=0; i<5; i++)
{
for(int j=0; j<=i; j++)
{
int x;
cin>>x;
v[i].push_back(x);
}
}
for(int i=0; i<5; i++)
{
if(i==0)
{
cout<<v[0][0]<<endl;
continue;
}
int in=0;
for(int j=0; j<v[i].size()-1; j++)
{
int a=v[i][j]+v[i][j+1];
int b=(v[i-1][j]-a)/2;
int ss=v[i][j]+b;
int sd=v[i][j+1]+b;
ary[in++]=b;
cout<<ss<<" "<<sd;
if(j<v[i].size()-2) cout<<" ";
}
cout<<endl;
int p=0;
for(int j=0; j<v[i].size(); j++)
{
cout<<v[i][j];
if(j<v[i].size()-1) cout<<" ";
if(p<in) cout<<ary[p];
if(j<v[i].size()-1) cout<<" ";
p++;
}
cout<<endl;
}
}
return 0;
}
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
#define n 20
using namespace std;
typedef long long ll;
typedef vector<int>vi;
vector< vi >v;
int main()
{
// READ;
// freopen("output.txt","w",stdout);
int test;
sc(test);
int ary[100];
while(test--)
{
v.assign(n,vi());
for(int i=0; i<5; i++)
{
for(int j=0; j<=i; j++)
{
int x;
cin>>x;
v[i].push_back(x);
}
}
for(int i=0; i<5; i++)
{
if(i==0)
{
cout<<v[0][0]<<endl;
continue;
}
int in=0;
for(int j=0; j<v[i].size()-1; j++)
{
int a=v[i][j]+v[i][j+1];
int b=(v[i-1][j]-a)/2;
int ss=v[i][j]+b;
int sd=v[i][j+1]+b;
ary[in++]=b;
cout<<ss<<" "<<sd;
if(j<v[i].size()-2) cout<<" ";
}
cout<<endl;
int p=0;
for(int j=0; j<v[i].size(); j++)
{
cout<<v[i][j];
if(j<v[i].size()-1) cout<<" ";
if(p<in) cout<<ary[p];
if(j<v[i].size()-1) cout<<" ";
p++;
}
cout<<endl;
}
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন