a005.
Eva 的回家作業
--
POJ
| From: [39.13.53.4] |
發表日期
:
2014-06-12 18:41
#include <iostream>
using namespace std;
int a[11] = { 0 };
int main()
{
char i;
int t;
char j;
while (1)
{
cin >> a[0];
if (a[0] != 0)
{
for (i = 0; i < a[0]; i++)
{
t = 1 + (i * 5);
for (j = 0; j <= 3; j++)
{
cin >> a[t + j];
}
if (a[t + 1] - a[t] == a[t + 2] - a[t + 1])
{
a[t + 4] = a[t + 3] + (a[t + 1] - a[t]);
}
if (a[t + 1] / a[t] == a[t + 2] / a[t + 1])
{
a[t + 4] = a[t + 3] * (a[t + 1] / a[t]);
}
}
t = 1;
a[0] = 0;
cout << a[t] << " " << a[t + 1] << " " << a[t + 2] << " " << a[t + 3] << " " << a[t + 4] << endl;
cout << a[t+5] << " " << a[t + 6] << " " << a[t + 7] << " " << a[t + 8] << " " << a[t + 9] << endl;
}
}
return 0;
}