Last active
May 8, 2016 02:24
-
-
Save cthbst/6574934ebe42c0b0e943358debe9ab33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std ; | |
int main(){ | |
int Tasks ; | |
int a[5] ; | |
cin >> Tasks ; | |
while (Tasks--){ | |
//input ------------- | |
for (int i=0 ;i<4 ;i++ ) | |
cin >> a[i] ; | |
//solve ------------- | |
if (a[1]-a[0]==a[2]-a[1]) // 等差數列 | |
a[4]=a[3]*2-a[2] ; | |
else // 等比數列 | |
a[4]=a[3]*a[3]/a[2] ; | |
//output ------------ | |
for (int i=0 ;i<4 ;i++ ) | |
cout << a[i] << " " ; | |
cout << a[4] << endl ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment