ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1585. Penguins

Not working and WA #1; what's wrong here?
Posted by Neeraj Kumar 3 Jan 2015 17:30
#include<stdio.h>
#include <string.h>
// n is not required at all, i am leaving it.
int main(){

int n, ce, cm, cl, max = 0;
char c;
scanf ("%d", &n);

while ((c = getchar())!= EOF){
    if (c == 'E') ce++;
    else if (c == 'M') cm++;
    else if (c == 'L') cl++;
}
/*
Emperor Penguin
Macaroni Penguin
Little Penguin
*/

max = (ce > cm) ? ((ce > cl) ? ce : cl) : ((cm > cl) ? cm : cl);
if (max == ce) printf("Emperor Penguin");
else if (max == cm) printf ("Macaroni Penguin");
else printf ("Little Penguin");


return 0;
}