... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Tuesday, December 24, 2013

UVA-12403 :: Save Setu

#include <stdio.h>
int main ()
{
     int t , k ,i ;
     char ch ,s1 [100] = "donate" , s2[100] = "report" , s[100]  ;
     int cnt =0 ,cnt2 =0 ;

     scanf ("%d",&t) ;

     for (i=1 ; i<=t ; i++)
     {
        scanf ("%s",s) ;

        if (s[0] == s1[0] )
        {
             scanf ("%d",&k) ;
             if (k >= 100 && k <= 100000) cnt = cnt + k ;
             else cnt2 = cnt2 + k ;
        }

        else if (s[0] == s2[0] )  printf ("%d\n",cnt+cnt2) ;

     }

return 0 ;
}