Wednesday, June 18, 2014

Codechef ANUDTC - Divide the Cake solution

Codechef ANUDTC - Divide the Cake: http://www.codechef.com/problems/ANUDTC

Codechef ANUDTC - Divide the Cake editorial: http://discuss.codechef.com/questions/43059/anudtc-editorial

Codechef ANUDTC - Divide the Cake solution: http://ideone.com/uRDFQe

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
    int t, n;
    scanf("%d", &t);
    while(t--) {
        scanf("%d", &n);
        if(360%n) printf("n ");
        else printf("y ");
        if(360/n<1) printf("n ") ;
        else printf("y ");
        if(n*(n+1)/2>360) printf("n ");
        else printf("y ");
        printf("\n");
    }
    return 0;
}

No comments:

Post a Comment