a005.
Eva 的回家作業
--
POJ
| From: [111.248.186.78] |
發表日期
:
2013-09-18 05:05
#include <iostream>
using namespace std;
int dosomething(int a[]){
if ((a[1]-a[0]) == (a[2] - a[1])){
return a[3] + (a[2] - a[1]);
}else{
return a[3] * (a[2] / a[1]);
}
}
int main() {
int count,i;
while(cin >> count){
int a[count-1][4];
for (i = 0 ; i < count ; i++){
cin >> a[i][0] >> a[i][1] >> a[i][2] >> a[i][3];
a[i][4] = dosomething(a[i]);
}
for (i = 0 ; i < count ; i++){
cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << " " << a[i][3] << " " << a[i][4] << endl;
}
}
return 0;
}
input 2
1 2 3 4
1 2 3 4
OUT 1 2 3 4 1
1 2 3 4 5