您的答案為: 1 1 1 1 1
您的答案為: 1 1 1 1 1
我是這樣,你可以參考看看,我2個程式碼解題都AC
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f,x;
cin>>f;
for(e=1;e<=f;e++){
while(cin>>a>>b>>c>>d){
if(b-a==c-b){
x=b-a;
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+x<<endl;
}
else{
x=d/c;
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d*x<<endl;
}
}
}
}
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f,x;
while(cin>>f){
for(e=1;e<=f;e++){
cin>>a>>b>>c>>d;
if(b-a==c-b){
x=b-a;
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d+x<<endl;
}
else{
x=d/c;
cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<d*x<<endl;
}
}
}
}