gym101673G. A Question of Ingestion (DP)】的更多相关文章

题意:有最多100天 每天有一个食物量 你一开始有一个最大胃口表示你最开始能吃多少食物 如果你昨天吃了 那么今天的胃口为昨天的2/3 如果你前天吃了 昨天没吃 那么你的胃口可以恢复到前天的情况 如果你有连续两天没吃了 那么你就可以恢复到最大胃口了 问怎样安排使一共吃到的食物最多 题解:就裸裸的DP了,反正从没出过DP(的DP选手 dp[i][j][k]表示第i天结束后 当前的胃口能级为j 这一天进行的操作k k为0表示今天吃了 k为1表示今天没吃 那么转移也没什么难的了  转移模拟这几种状态即可…
A .Abstract Art 题意:求多个多边形的面积并. 思路:模板题. #include<bits/stdc++.h> using namespace std; typedef long long ll; const double inf=1e200; ; *atan(1.0); :(x<?-:);} struct point{ double x,y; point(,):x(a),y(b){} }; point operator +(point A,point B) { retur…
A:Abstract Art 题意:给出n个多边形,求n个多边形分别的面积和,以及面积并 思路:模板 #include <bits/stdc++.h> using namespace std; #define N 1010 #define mkp make_pair ; inline int sgn(double x) { ; ) ; ; } struct Point { double x, y; inline Point() {} inline Point(double x, double…
ECNA 2017 Abstract Art 题目描述:求\(n\)个多边形的面积并. solution 据说有模板. Craters 题目描述:给定\(n\)个圆,求凸包的周长. solution 求出两两圆的公切线的切点,做凸包,算周长时判断两个点是否在同一个圆上,以及是优弧还是劣弧. 或是将每个圆拆成\(3000\),做凸包,算周长时判断两个点是否在同一个圆上. 时间复杂度:\(O(n^2)\) DRM Messages 题目描述: solution 模拟 Game of Throwns…
# 数据结构类 ### 线段树 segment tree http://www.careercup.com/question?id=5165570324430848 找区间内的value的个数 二维线段树 http://www.careercup.com/question?id=5746897784406016 http://www.careercup.com/question?id=15443800 关于线段树的构造,参考<手写代码必备手册>(https://github.com/soulm…
You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Subscribe to see which companies asked this question 简单的dp问题,代码如下: class Solution {…
地址:https://www.nowcoder.com/acm/contest/15#question A(树形dp) 分析 dp[i][0],dp[i][1]分别表示以i为根的子树中,有多少个点到i的距离为偶数.为奇数 那么每次merge i点和i点的某个儿子u的时候,统计一下答案就行了,ans+=dp[i][0]*dp[u][1]+dp[i][1]*dp[u][0] 时间复杂度$O(n)$ B(枚举) 分析 每次枚举一个区间(i,j),统计1~i-1中有多少个区间异或值和(i,j)的异或值相…
Trade Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3401 Appoint description:  Description Recently, lxhgww is addicted to stock, he finds some regular patterns after a few days' study.  He fo…
Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1219    Accepted Submission(s): 361 Problem Description FSF is addicted to a stupid tower defense game. The goal of tower…
C. The Values You Can Make time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The price…
2014多校7 第二水的题 4939 Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 366    Accepted Submission(s): 88 Problem Description    FSF is addicted to a stupid tower defense gam…
G - Simple String Problem Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2218 Description Recently, you have found your interest in string theory. Here is an interesting question about strings.…
题目 Source http://www.lightoj.com/volume_showproblem.php?problem=1283 Description You are a librarian. You keep the books in a well organized form such that it becomes simpler for you to find a book and even they look better in the shelves. One day yo…
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. &…
参考链接:https://docs.google.com/spreadsheet/pub?key=0Aqt--%20wSNYfuxdGxQWVFsOGdVVWxQRlNUVXZTdEpOeEE&output=html ID Question Diff Freq Data Structure Algorithms                                   1 Two Sum 2 5 array sort           set Two Pointers   2 Add…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3401 Trade Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) 问题描述 Recently, lxhgww is addicted to stock, he finds some regular patterns after a few days' study. He forecast…
E. The Values You Can Make     Pari wants to buy an expensive chocolate from Arya. She has n coins, the value of the i-th coin is ci. The price of the chocolate is k, so Pari will take a subset of her coins with sum equal to k and give it to Arya. Lo…
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. Example: nums = [1, 2, 3] target = 4 The possible combination ways are: (1, 1, 1, 1) (1, 1, 2) (1,…
True Liars Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2087   Accepted: 640 Description After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exha…
Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target. Example: nums = [1, 2, 3] target = 4 The possible combination ways are: (1, 1, 1, 1) (1, 1, 2) (1,…
Tree Maker Problem Description Tree Lover loves trees crazily. One day he invents an interesting game which is named Tree Maker. In this game, all trees are binary trees. Initially, there is a tree with only one vertex and a cursor on it. Tree Lover…
Recently poet Mr. po encountered a serious problem, rumor said some of his early poems are written by others. This brought a lot of trouble to Mr. po, so one day he went to his best friend MasterO for help. MasterO handed over a small wooden box with…
Description After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend of the foggy island, which h…
Collecting Bugs Time Limit: 10000MS   Memory Limit: 64000K Total Submissions: 1792   Accepted: 832 Case Time Limit: 2000MS   Special Judge Description Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material st…
Description Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets a new program, he classifies all possible bugs into n categories. Each day he discovers exac…
Stupid Tower Defense Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1557 Accepted Submission(s): 445 Problem Description FSF is addicted to a stupid tower defense game. The goal of tower defen…
DP: DP[len][k][i][j] 再第len位,第一个数len位为i,第二个数len位为j,和的第len位为k 每一位能够从后面一位转移过来,能够进位也能够不进位 A Famous Equation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 500    Accepted Submission(s): 147 Proble…
题链:http://acm.hdu.edu.cn/showproblem.php?pid=5282 Senior's String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 142    Accepted Submission(s): 40 Problem Description Xuejiejie loves strings m…
Collecting Bugs Time Limit: 10000MS   Memory Limit: 64000K Total Submissions: 2678   Accepted: 1302 Case Time Limit: 2000MS   Special Judge Description Ivan is fond of collecting. Unlike other people who collect post stamps, coins or other material s…
213. House Robber II     Total Accepted: 24216 Total Submissions: 80632 Difficulty: Medium Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will…