Guest User

Crack - GOOD

a guest
May 30th, 2014
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.93 KB | None | 0 0
  1. /*
  2. ID: dixtosa1
  3. PROG: milk2
  4. LANG: C++11
  5. */
  6. #pragma comment(linker, "/STACK:16777216")
  7. #include <iostream>
  8. #include <fstream>
  9. #include <cstdio>
  10. #include <stdio.h>
  11. #include <cstdlib>
  12. #include <stdlib.h>
  13. #include <string>
  14. //#include <string.h>
  15. #include <list>
  16. #include <fstream>
  17. #include <algorithm>
  18. #include <cmath>
  19. #include <map>
  20. #include <vector>
  21. #include <iomanip>
  22. #include <queue>
  23. #include <deque>
  24. #include <set>
  25. #include <stack>
  26. #include <sstream>
  27. #include <assert.h>
  28. #include <functional> //std::greater<int>
  29. //#include <tuple>
  30.  
  31. //#include "Biginteger.cpp"
  32. //#include "sqrt.cpp"
  33. //#include "tree.cpp"
  34. //#include "funcs.cpp"
  35.  
  36. typedef long long ll;
  37. typedef std::pair<ll,ll> pii;
  38. #define ALL(x)           (x).begin(), (x).end()
  39. #define forn(N)          for(ll i = 0; i<(int)N; i++)
  40. #define fornj(N)         for(ll j = 0; j<(int)N; j++)
  41. #define fornk(N)         for(ll k = 0; k<(int)N; k++)
  42. #define foreach(c,itr) for(auto itr=(c).begin();itr!=(c).end();itr++)
  43. #define PI 3.1415926535897932384626433
  44. #define LINF (1LL<<60)
  45. #define INF (1<<30)
  46. //#define MOD 1000007
  47. #define awesome vector<int> A(N); forn(N) scanf("%d", &A[i]);
  48. #define v vector
  49. #define File "Patterns"
  50. using namespace std;
  51.  
  52. v<int> DP(10000);
  53. int MAX = -INF, ans = 0;
  54. int main()
  55. {
  56.     #if defined(_DEBUG) || defined(_RELEASE)
  57.     freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
  58.     #else
  59.     //freopen(File".in", "r", stdin); freopen(File".out", "w", stdout);
  60.     #endif
  61.  
  62.     v<int> A(1);
  63.    
  64.     char chr;
  65.     while(scanf("%c", &chr) == 1)
  66.     {
  67.         if (isalpha(chr)) A.back()++;
  68.         else if (A.back() > 0) A.push_back(0);
  69.     }
  70.     int N = A.size();
  71.  
  72.     if (N == 1) return cout << A[0], 0;
  73.  
  74.     DP[0] = A[0];
  75.     DP[1] = A[1];
  76.     MAX = DP[0];
  77.     ans = max(DP[0], DP[1]);
  78.     for(int i = 2; i<N; i++)
  79.     {
  80.         DP[i] = A[i] + MAX;
  81.         MAX = max(MAX, DP[i - 1]);
  82.         ans = max(ans, DP[i]);
  83.     }
  84.     cout << ans;
  85.  
  86.     //printf("\n\ntime-%.3lf", clock()*1e-3);
  87.     return 0;
  88. }
Add Comment
Please, Sign In to add comment