附上程式碼
#include <iostream>
using namespace std;
int main( )
{
int n,a,b,c,d;
cin>>n;
if (n>20||n<0)
{
return 0;
}
int num[n][4];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 4; j++)
{
cin>>num[i][j];
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 4; j++)
{
if (num[i][j]>105)
{
return 0;
}
}
}
for (int i = 0; i < n; i++){
if (num[i][1]-num[i][0]==num[i][2]-num[i][1]){
cout<<num[i][0]<<" "<<num[i][1]<<" "<<num[i][2]<<" "<<num[i][3]<<" "<<num[i][3]+(num[i][1]-num[i][0])<<endl;
}else{
cout<<num[i][0]<<" "<<num[i][1]<<" "<<num[i][2]<<" "<<num[i][3]<<" "<<num[i][3]*(num[i][1]/num[i][0])<<endl;
}
}
return 0;
}
附上程式碼
#include
using namespace std;
int main( )
{
int n,a,b,c,d;
cin>>n;
if (n>20||n<0)
{
return 0;
}
int num[n][4];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 4; j++)
{
cin>>num[i][j];
}
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < 4; j++)
{
if (num[i][j]>105)
{
return 0;
}
}
}
for (int i = 0; i < n; i++){
if (num[i][1]-num[i][0]==num[i][2]-num[i][1]){
cout<<num[i][0]<<" "<<num[i][1]<<" "<<num[i][2]<<" "<<num[i][3]<<" "<<num[i][3]+(num[i][1]-num[i][0])<<endl;
}else{
cout<<num[i][0]<<" "<<num[i][1]<<" "<<num[i][2]<<" "<<num[i][3]<<" "<<num[i][3]*(num[i][1]/num[i][0])<<endl;
}
}
return 0;
}
喔耶