Friday, December 8, 2017

12403 Save Setu Uva Problem Solution



#include<bits/stdc++.h>

// Nayeem Shahriar Joy, Applied Physics & Electronic Engineering , University of Rajshahi.

using namespace std;

int main ()
{
    int t,a,b,c;

    cin>>t;

    long long sum=0;

    string s;


    while ( t-- )
    {
        cin>>s;
        if(s=="donate")
        {
            cin>>a;
            sum=sum+a;
        }
        else
        {
            cout<<sum<<endl;
        }
    }

    return 0;
}

No comments:

Post a Comment