hihoCoder Challenge 8 register

Ended

Participants:280

Verdict:Accepted
Submitted:2015-02-01 19:40:13

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
using namespace std;
struct card {
    int hp, att, c;
    bool d;
};
const int maxn = 10;
int n, perm[maxn], fac[maxn], ans;
card a[maxn];
void dfs(int al, int vd, bool dd, int ts) {
    if (!al || !vd) {
        for (int i = 0; i < n; ++ i)
            if (a[i]. hp > 0)
                ts += a[i]. c * a[i]. att;
        if (ts > ans)
            ans = ts;
    }
    else {
        for (int i = 0; i < n; ++ i)
            if (a[i]. hp > 0 && a[i]. c) {
                -- a[i]. c;
                if (a[i]. d) {
                    a[i]. d = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX