UCF “Practice” Local Contest — Aug 25, 2018 Rummy Score
Posted 2aptx4869
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UCF “Practice” Local Contest — Aug 25, 2018 Rummy Score相关的知识,希望对你有一定的参考价值。
数据范围很小,搜索即可
#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的主要内容,如果未能解决你的问题,请参考以下文章
UCF Local Programming Contest 2015(Practice)个人分析
UCF Local Programming Contest 2012(Practice)
UCF “Practice” Local Contest — Aug 25, 2018 Rummy Score
UCF “Practice” Local Contest — Aug 25, 2018 Call Me Maybe
UCF “Practice” Local Contest — Aug 25, 2018 Boots Exchange 水题