底下用陣列就不通過
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a[4],b,c,d,e,i;
while(cin >> e){
for(i=1;i<=e;i++){
cin >> a[1] >> a[2] >> a[3] >> a[4];
if (a[2]-a[1]==a[3]-a[2] && a[3]-a[2]==a[4]-a[3]){
cout << a[1] << " " << a[2] << " " << a[3] << " " << a[4] << " " << a[4]+a[2]-a[1] << endl;
}
else
cout << a[1] << " " << a[2] << " " << a[3] << " " << a[4] << " " << a[4]*a[2]/a[1] << endl;
}
}
return 0;
}
底下不用陣列就通過
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a,b,c,d,e,i;
while(cin >> e){
for(i=1;i<=e;i++){
cin >> a >> b >> c >> d;
if (b-a==c-b && c-b==d-c){
cout << a << " " << b << " " << c << " " << d << " " << d+b-a << endl;
}
else
cout << a << " " << b << " " << c << " " << d << " " << d*b/a << endl;
}
}
return 0;
}