zoukankan      html  css  js  c++  java
  • B. Mancala (Codeforces Round #478 (Div. 2))

     1 #include <bits/stdc++.h>
     2 using namespace std;
     3 const int maxn = 14;
     4 typedef long long ll;
     5 ll a[maxn];
     6 ll b[maxn];
     7 
     8 int main(){
     9     for(int i =0 ;i < maxn;i++){
    10         cin >> a[i];
    11     }
    12     ll ans = -1;
    13     for(int i = 0;i < maxn;i++){
    14         for(int j = 0;j < maxn;j++) b[j] = a[j];
    15         b[i] = 0;
    16         int x = a[i] / maxn;
    17         int y = a[i] % maxn;
    18         for(int j = 0;j < maxn;j++)
    19             b[j] += x;
    20         for(int j = 1;j <= y;j++)
    21             b[(j+i)%maxn]++;
    22         ll sum = 0;
    23         for(int j = 0;j < maxn;j++)
    24             if(b[j]%2 == 0)
    25             sum += b[j];
    26         if(ans < sum)
    27             ans = sum;
    28     }
    29     cout << ans << endl;
    30     return 0;
    31 }

    B. Mancala

  • 相关阅读:
    vc++ 编译器工具
    lesson 17 进程间通信 孙鑫 VC++
    VC++ msdn
    VC++ 相关问题
    MySQL
    Git
    Angular
    Linux
    阿里云服务器
    Git
  • 原文地址:https://www.cnblogs.com/ouyang_wsgwz/p/9010526.html
Copyright © 2011-2022 走看看