Advertisement
noshin98

uva 12403

Jul 12th, 2016
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     long long  t,i,d=0,s=0;
  6.     char n[100];
  7.     while(scanf("%lld",&t)==1)
  8.     {
  9.         for(i=1;i<=t;i++)
  10.         {
  11.             scanf("%s",n);
  12.             if(strcmp(n,"donate")==0)
  13.             {
  14.                 scanf("%lld",&d);
  15.                 s=s+d;
  16.             }
  17.             else
  18.                 printf("%lld\n",s);
  19.         }
  20.     }
  21.     return 0;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement