题意:一个特殊21点游戏 具体http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2852 题解:建一个三维dp,表示三个卡槽分别为i,j,l分时最大的收益情况. 对所有当前状态dp,将下一个可能的状态存入f, 坑:~-1==0 #define _CRT_SECURE_NO_WARNINGS #include<cstring> #include<cctype> #include<cstdlib> #i…
Hongcow Buys a Deck of Cards 啊啊啊, 为什么我连这种垃圾dp都写不出来.. 不是应该10分钟就该秒掉的题吗.. 从dp想到暴力然后gg, 没有想到把省下的红色开成一维. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair&…
题意:现在有n张卡片(n <= 16), 每一轮你可以执行两种操作中的一种.1:获得一张红色令牌和一张蓝色令牌.2:购买一张卡片(如果可以买的话),购买的时候蓝色卡片可以充当蓝色令牌,红色同理,但是购买后只消耗令牌,不消耗卡片.问最少多少轮可以购买全部卡片. 思路1:状压DP.我们发现卡片可以减少令牌的使用,如果不考虑卡片的话,总花费其实是固定的.所以,只要我们算出了通过令牌最多可以减免多少花费,就可以得到答案了. 设dp[i][j]为卡片的够买状态为i时,其中红色卡片的花费减免了j,蓝色卡片花…
C. Hongcow Buys a Deck of Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day, Hongcow goes to the store and sees a brand new deck of n special cards. Each individual card is eit…
地址:http://codeforces.com/problemset/problem/744/C 题目: C. Hongcow Buys a Deck of Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day, Hongcow goes to the store and sees a brand ne…
In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in eac…
In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in eac…
In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in eac…
POJ 1511 Invitation Cards / UVA 721 Invitation Cards / SPOJ Invitation / UVAlive Invitation Cards / SCU 1132 Invitation Cards / ZOJ 2008 Invitation Cards / HDU 1535 (图论,最短路径) Description In the age of television, not many people attend theater perfor…
In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in eac…