1629 - Cake slicing Time limit: 3.000 seconds A rectangular cake with a grid of m * n <tex2html_verbatim_mark>unit squares on its top needs to be sliced into pieces. Several cherries are scattered on the top of the cake with at most one cherry on a…
Problem G. Birthday Cake Problem's Link:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=13&problem=1108&mosmsg=Submission+received+with+ID+14413715 Mean: http://luckycat.kshs.kh.edu.tw/…
Problem G. Birthday Cake Background Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center is at (0,0), and the cake's length of radius is 100. There are 2N…
Adventures in Moving - Part IV 题意: 汽车邮箱容量200升,最初有100升油,要求到达终点油箱中的油不少于100升的最小花费,不能到达终点输出Impossible. 汽车走1单位距离消耗1升油. 输入t组数据 输入n表示要求从起点到距离为n的点 输入若干个加油站的a,b,表示加油站距离起点的距离和每升油的价格: 代码: //dp[i][j]=min(dp[i][j],dp[i-1][j+dis-k]+k*w),dp[i][j]表示到达 //i加油站时还剩j升油,d…
#include<bits/stdc++.h> using namespace std; int n,m,k; int cherry[405],dp[405][405]; int solve(int l,int r) { //printf("%d,%d %d,%d\n",l/m,l%m,r/m,r%m); int &ret=dp[l][r]; if(ret!=-1)return ret; int nmin=30,nmax=-1,mmin=30,mmax=-1; fo…
题解:由于解太多,随机抓 A.B, 只要有符合就行了: (首先,Ax+By=0必须表示直线,即A.B不能同时为0:另外,要注意到直线不能过输入中的2N个点:检测点在直线的哪一侧,只需要简单的线性规划的知识) #include <cstdio> #include <cstdlib> ], y[]; int test(int A, int B, int N) { static int i, pos, neg, tmp; pos = , neg = ; *N-; i >= ; i-…