fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. vector<long long> a(14,0);
  6. long long res = 0;
  7.  
  8.  
  9. void init(){
  10. for(int i=0;i<14;i++) cin >> a[i];
  11. }
  12.  
  13. void process(){
  14. for(int i=0;i<14;i++){
  15. vector<long long> b = a;
  16. long long val = a[i] / 14;
  17. long long du = a[i] % 14;
  18. int indexz = i+1;
  19. for(int j=0;j<14;j++) b[j] += val;
  20. while(du--){
  21. if (indexz == 14) indexz = 0;
  22. b[indexz]++;
  23. indexz++;
  24. }
  25. long long sumz = 0;
  26. for(int j=0;j<14;j++){
  27. if (b[j] % 2 == 0) sumz += b[j];
  28. }
  29. res = max(res, sumz);
  30. }
  31. cout << res;
  32.  
  33. }
  34.  
  35. int main(){
  36.  
  37. init();
  38. process();
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0s 4372KB
stdin
Standard input is empty
stdout
Standard output is empty