Wednesday, 29 July 2015

HC

Standard

Happy Coins

Link to the question : HC

HINT :

You can ignore the word consecutive. Though I wont say it misleading, but not taking that into consideration will make the problem solving a bit more simple. Try some cases and even if you cant check the source code.

SOURCE CODE :


#include<stdio.h>

#include<string.h>

int main()

{

long int t,i,n,count=0;

char s[4],a[]="lxh";

scanf("%ld",&t);

while(t--)

{

    count=0;

    scanf("%ld",&n);

    while(n--)

    {

        scanf("%s",s);

        if(strcmp(s,a)==0)

            count++;

    }

    if(count%2==0)

        printf("hhb\n");

    else

        printf("lxh\n");



}

return 0;



}

RECOMMENDED QUESTION :

After solving this question, I would like you to try your hands out in this question . 

0 comments:

Post a Comment