Thursday, 10 May 2012

UVa 12403 Save Setu Solution


#include<iostream>
#include<list>
#include<string>
#include<cstring>
#include<sstream>
#include<cctype>
#include<string.h>
#include<algorithm>
#include<cmath>
#include<stack>
#include<fstream>
#include<cstdlib>
#include<vector>
#include<map>
#include<utility>
#include<iomanip>
#include<queue>
using namespace std;
#define clr(a) memset(a,0,sizeof(a))
#define PB push_back
#define pi 3.1415926535897932384626433832795

int main()
{
    long long current,money,i,j,tc,n;
    string s;
    //cin>>tc;
    //for(i=1;i<=tc;i++)
    //{
        current=0;
        cin>>n;
        //cout<<"Case "<<i<<":"<<endl;
        for(j=0;j<n;j++)
        {
            cin>>s;
            if(s=="donate")
            {
                cin>>money;
                current+=money;
            }
            else
            cout<<current<<endl;
        }

    //}
return 0;
}

No comments:

Post a Comment