Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

what is wrong with my chef and polygon cakes code?

$
0
0

include<iostream>

include<math.h>

using namespace std;

int main()

{

float T,N,A,K,total,D,p,Ak,x,y,gcd,temp; int X,Y;

cin>>T;

if(T<1||T>50)

{ do

{ cout<<"\n invalid input";

cout<<"\n please enter again";

cin>>T;

} while(T<1||T>50);

}

for(int i=1;i<=T;i++)

{

cin>>N>>A>>K;

if(N<3||N>1000) {

do

{ cout<<"\n invalid input";

cout<<"\n please enter again";

cin>>N;

} while(N<3||N>1000);

}

if(A<1||A>1000000000)

{

do

{ cout<<"\n invalid input";

cout<<"\n please enter again";

cin>>A;

} while(A<1||A>1000000000);

}

if(A>360)

{

p=A/360;

A-=360*p;

}

if(K<1||K>N)

{

do

{ cout<<"\n invalid input";

cout<<"\n please enter again";

cin>>K;

} while(K<1||K>N);

}

X=(AN(N-1))+((K-1)((N-2)(360))-(2AN)); Y=(N*(N-1)); } x=X; y=Y; while(y!=0) { gcd=x-y; x=y; y=gcd; if(y>x) { temp=x; x=y; y=temp; } } X/=x; Y/=x; cout<<X<<" "<<Y; return 0;

}


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>