#include <iostream>
using namespace std ;
int main ()
{
int a ;
int b ;
int c ;
int d ;
while (cin >> a >> b >> c >> d )
{
if(b-a == c-b)
{
cout << a << " " << b << " " << c << " " << d << " " << d + d-c << endl ;
}
else if(b/a==c/b)
{
cout << a << " " << b << " " << c << " " << d << " " << d * (d/c) << endl ;
}
}
//system("pause");
return 0;
}
對不起,我還是新手,我這樣寫是有問題的嗎???
#include
using namespace std ;
int main ()
{
int a ;
int b ;
int c ;
int d ;
while (cin >> a >> b >> c >> d )
{
if(b-a == c-b)
{
cout << a << " " << b << " " << c << " " << d << " " << d + d-c << endl ;
}
else if(b/a==c/b)
{
cout << a << " " << b << " " << c << " " << d << " " << d * (d/c) << endl ;
}
}
//system("pause");
return 0;
}
對不起,我還是新手,我這樣寫是有問題的嗎???
你似乎沒看輸入說明
第一行是數列的數目t(0 <= t <= 20)。 以下每行均包含四個整數,表示數列的前四項。 約定數列的前五項均為不大於105的 自然數,等比數列的比值也是自然數。