Skip to content

Instantly share code, notes, and snippets.

@completejavascript
Created September 15, 2018 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save completejavascript/2cd310ad154d8ae20b600113bb4efba2 to your computer and use it in GitHub Desktop.
Save completejavascript/2cd310ad154d8ae20b600113bb4efba2 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
//freopen("input.txt","r",stdin);
int a1, a2, a3;
while(true)
{
cin >> a1 >> a2 >> a3;
if(a1 == 0 && a2 == 0 && a3 == 0) break;
int different = a2 - a1;
if(a2 + different == a3)
{
cout << "AP " << a3 + different << endl;
}
else
{
int ratio = a2/a1;
cout << "GP " << a3 * ratio << endl;
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment