Setu 1387

Problem Link

<Source Code>

#include <stdio.h>
#include <string.h>
int main ()
{
int t,i,j,s,d=0,te,no=0,re[105];
char a [100];
scanf(“%d”,&te);
while(te–)
{
scanf (“%d”,&t);
int i=0,s=0;
while (t–)
{
scanf (“%s”,a);
if (strcmp (a,”donate”)==0)
{
scanf (“%d”,&d);
s+=d;
}
else
{
re[i]=s;
i++;
}
}
printf (“Case %d:\n”,++no);
for( j=0;j<i;j++)
printf (“%d\n”,re[j]);
}
return 0;
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s