Need Urgent. Chef loves circular cakes. He divides them into smaller pieces and
ID: 3557763 • Letter: N
Question
Need Urgent.
Chef loves circular cakes. He divides them into smaller pieces and sells them. You are to help him in this work.
Today Chef has cooked the brand new circular cake. To split the cake Chef can make several (possibly, zero) cuts. Each cut should be a straight line going from the center of the cake to its border. Also, the angle between any two cuts should have positive integer value (Chef measure all the angles in degrees). Chef consider two pieces of cake equal if the appropriate angles are equal.
The picture contains two distinct pieces, and two cuts. Red part on the image shows one piece. The appropriate angle is AOB.
Chef gives to you an integer N, denoting the number of pieces Chef wants to make. You need to answer the following questions:
Input
First line contains a single integer T denoting the number of test cases. Each of the following T lines contain a single integer N denoting the number of pieces Chef wants to make.
Output
For each test case, output one line containing 3 space separated characters.
Above, we defined the 3 questions that Chef will ask. Output 'y' for yes or 'n' for no (quotes for clarity) for each of those questions.
Answers for 3 questions (in the order above) must be space separated on the same line.
Constraints
Example
Explanation / Answer
Haha ! codeshef !!
Your professor must be a noob xP
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<cstring>
#include<cctype>
using namespace std;
#define INF 999999999
#define print(x) printf("%d",x)
int main()
{
int t;
cin>>t;
while(t--)
{
int n,i;
cin>>n;
if(n>360)
printf("n n n ");
else if (n==1)
printf("y y y ");
else
{
if(360%n==0)
printf("y y ");
else
printf("n y ");
i=(n*(n+1))/2;
if(360>=i)
printf("y ");
else
printf("n ");
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.