let's start Code

1387 - Setu

1387 - Setu

solution :


 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
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    // freopen("in.txt", "r", stdin);
    int T;
    cin >> T;
    for(int cs = 1; cs <= T; ++cs){
        long long ans = 0;
        int n;
        cin >> n;
        cout << "Case "<<cs<< ":\n";
        while(n--){
            string s;
            cin >> s;
            if(s == "donate"){
                int x;
                cin >> x;
                ans += x;
            }
            else{
                cout << ans<<endl;
            }
        }
    }
}

Share:

No comments:

Post a Comment

About

let's start CODE

Popular Posts