Whats Next(ACPC10A)
#include <bits/stdc++.h>
using namespace std;
int main() {
int x,y,z;
while(1)
{
cin>>x>>y>>z;
if(x==0 && y==0 && z==0)
break;
else if((x+z)==2*y)
{
int next=x+3*(y-x);
cout<<"AP "<<next<<endl;
}
else
{
int next=x*pow(y/x,3);
cout<<"GP "<<next<<endl;
}
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main() {
int x,y,z;
while(1)
{
cin>>x>>y>>z;
if(x==0 && y==0 && z==0)
break;
else if((x+z)==2*y)
{
int next=x+3*(y-x);
cout<<"AP "<<next<<endl;
}
else
{
int next=x*pow(y/x,3);
cout<<"GP "<<next<<endl;
}
}
return 0;
}
No comments:
Post a Comment