Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. cin>>t;
  7. int cnt=1;
  8. while(t--)
  9. {
  10. int n;
  11. cin>>n;
  12. string s;
  13. int a;
  14. long long sum=0;
  15. printf("Case %d:\n",cnt++);
  16. for(int i=0; i<n; i++)
  17. {
  18. cin>>s;
  19. if(s=="donate")
  20. {
  21. cin>>a;
  22. sum+=a;
  23. }
  24. if(s=="report")
  25. {
  26. printf("%lld",sum);
  27. }
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement