标签:图片 min scan amp ble 技术 efi include png
数据范围很小,搜索即可
#include<bits/stdc++.h> #define sc(n) scanf("%d",&n) #define ll long long #define db double #define P pair<int,int> using namespace std; int a[14], ans, v[14]; void dfs(int k, int tot, int kind, int cnt, int tott, int b) { if (b >= 7) { if (cnt < 3) tot += tott; ans = min(tot, ans); return; } if (tot >= ans) return; if (k <= 13 && a[k]) { --a[k]; if (kind == 1) dfs(k, tot, 1, cnt + 1, tott + k, b + 1); else dfs(k + 1, tot, 2, cnt + 1, tott + k, b + 1); ++a[k]; } int kk = 1; while (a[kk] == 0) ++kk; --a[kk]; if (cnt < 3) tot += tott; dfs(kk, tot, 1, 1, kk, b + 1); dfs(kk + 1, tot, 2, 1, kk, b + 1); ++a[kk]; } int main() { int b = 14; for (int i = 1; i <= 7; ++i) sc(a[0]), ans += a[0], ++a[a[0]], b = min(b, a[0]); --a[b]; dfs(b, 0, 1, 1, b, 1); dfs(b + 1, 0, 2, 1, b, 1); printf("%d", ans); return 0; }
UCF “Practice” Local Contest — Aug 25, 2018 Rummy Score
标签:图片 min scan amp ble 技术 efi include png
原文地址:https://www.cnblogs.com/2aptx4869/p/12636591.html