LightOj 1387 - Setu

 // Verdict:: Accepted
// Do some modify and get AC on the "Uva 12403-Save Satu" problem.

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <string>
  5. #include <vector>
  6. #include <cmath>
  7. #include <cctype>
  8. #include <set>
  9. #include <list>
  10. #include <stack>
  11. #include <queue>
  12. #include <algorithm>
  13. #define sf scanf
  14. #define pf printf
  15. #define L long
  16. #define LL long long
  17. #define N 10000
  18. #define nl puts("")
  19. #define MOD 10000000007
  20. #define pb push_back
  21. #define ps push
  22. #define clr clear
  23. #define bn begin()
  24. #define ed end()
  25. using namespace std;
  26. int main()
  27. {
  28.     int tc,t,ar[101];
  29.     char ch[8];
  30.     sf("%d",&tc);
  31.     for (t=1;t<=tc;t++)
  32.     {
  33.         int n,len=0;
  34.         LL amount,r=0;
  35.         sf("%d",&n);
  36.         while(n--)
  37.         {
  38.             sf("%s",&ch);
  39.             if(!strcmp(ch,"donate"))
  40.             {
  41.                 sf("%lld",&amount);
  42.                 r+=amount;
  43.                 //ar[len++]=r;// c++;
  44.             }
  45.             else
  46.             {
  47.                 ar[len++]=r;
  48.             }
  49.         }
  50.         pf("Case %d:\n",t);
  51.         for (int i=0;i<len;i++)pf("%d\n",ar[i]);
  52.     }
  53.     return 0;
  54. }

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number