Thursday, March 3, 2016

UVA 12403

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<string.h>

using namespace std;

int main()
{
 int a,t,i,j;
 int sum=0;
 char word[100];
 
 cin>>t;
 while(t--)
 {
  cin>>word;
  if(strcmp(word,"donate")==0)
  {
   cin>>a;
   sum=sum+a;
  }
  else cout<<sum<<endl;
 }
 
 return 0;
}

No comments:

Post a Comment

Thank you for commenting. Please wait for response :)