C - Shopping Street(AtCoder Beginner Contest 080)
2017-12-03 22:29
447 查看
题目链接
https://beta.atcoder.jp/contests/abc080/tasks/abc080_c解题方法
因为一共只有十个时期所以我们可以枚举所有的状态,又因为必须有1个时期开放,所以我们从1而不是0开始枚举AC代码
#include<stdio.h> #include<string.h> #include <iostream> #include<algorithm> using namespace std; typedef long long LL; const int INF = 0x3f3f3f3f; const int maxn = 100 + 10; LL F[maxn][maxn]; LL P[maxn][maxn]; LL D[maxn]; int main() { LL n; while(scanf("%lld",&n) == 1) { for(int i = 1; i <= n; i++) for(int j = 1; j <= 10; j++) scanf("%lld",&F[i][j]); for(int i = 1; i <= n; i++) for(int j = 0; j <= 10; j++) scanf("%lld",&P[i][j]); LL Max = -1 * INF; for(int s = 1; s < (1 << 10); s++) { for(int i = 1; i <= n; i++) { D[i] = 0; for(int j = 1; j <= 10; j++) { if((F[i][j] << (j - 1)) & s) D[i]++; } } LL ans = 0; for(int i = 1; i <= n; i++) ans += P[i][D[i]]; Max = max(Max,ans); } cout<< Max <<endl; } }
相关文章推荐
- AtCoder Beginner Contest 080 C - Shopping Street【暴力枚举】
- AtCoder Regular Contest 080 E - Young Maids
- AtCoder Regular Contest 080 [CDEF]
- AtCoder Beginner Contest 075
- Atcoder Regular Contest 080 F Prime Flip
- AtCoder Beginner Contest 090 D - Remainder Reminder
- 【递归】【线段树】【堆】AtCoder Regular Contest 080 E - Young Maids
- AtCoder Regular Contest 080 CD题
- AtCoder Regular Contest 080 E - Young Maids 贪心+堆+RMQ
- AtCoder Beginner Contest 056 题解挖坑
- AtCoder Beginner Contest 063
- AtCoder Beginner Contest 066 D - 11
- AtCoder Beginner Contest 072
- AtCoder Tenka1 Programmer Beginner Contest D IntegerotS 数学
- AtCoder Beginner Contest 081 C
- Atcoder Beginner Contest 55 D Menagerie (枚举+验证)
- AtCoder Tenka1 Programmer Beginner Contest 解题报告
- AtCoder Beginner Contest 071 D - Coloring Dominoes
- AtCoder Beginner Contest 072
- AtCoder Beginner Contest 075 总结