9Google AdSense

12554 - A Special "Happy Birthday" Song!!!

View Problem
View Code
---------------------------------------------------------------------
#include<stdio.h>
int main()
{
   int t,tt,k,p,ll,h,hh,se,st;
   char happy[20][100]={"Happy","birthday","to","you","Happy","birthday","to",
       "you","Happy","birthday","to","Rujia","Happy","birthday","to","you"};
   char inp[200][200],ch;
   scanf("%d%c",&t,&ch);
   for(k=0;k<t;k++)
          gets(inp[k]);
   if(t<16)
   {      for(p=0,ll=0;p<16;p++,ll++)
      {
        if(ll==t)
           ll=0;
         printf("%s: %s\n",inp[ll],happy[p]);
      }   }
   else
   {
      for(h=0,hh=0;h<t;h++,hh++)
      {       if(hh>15)
        hh=0;
        printf("%s: %s\n",inp[h],happy[hh]);
      }
      if(hh!=0)
      {
         for(st=hh,se=0;st<16;st++,se++)
         printf("%s: %s\n",inp[se],happy[st]);
      }
   }
   return 0;
}