E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
cake
hdoj King's
Cake
5640 (模拟)
King'sCakeTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):411 AcceptedSubmission(s):339ProblemDescriptionItistheking'sbirthdaybeforethemilitaryparade.T
yanghui07216
·
2016-03-16 13:00
HDU 5640 King's
Cake
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5640代码:#include #include usingnamespacestd; intmain() { intt; scanf("%d",&t); while(t--) { inta,b; intans=1; scanf("%d%d",&a,&b); while(a!=b) { if(a>b)
qq_32473657
·
2016-03-15 15:00
ZOJ-3905-
Cake
【贪心】【dp】
ZOJ-3905-CakeTimeLimit:4SecondsMemoryLimit:65536KB AliceandBoblikeeatingcakeverymuch.Oneday,AliceandBobwenttoabakeryandboughtmanycakes.Nowweknowthattheyhaveboughtncakesinthebakery.Bothofthemlikedelici
loy_184548
·
2016-03-13 20:00
ZOJ
3905
HDU 5640 King's
Cake
【模拟】
题意:给定长方形,每次从中切去一个最大的正方形,问最终可以得到多少正方形。分析:过程类似求gcd,每次减去最小的边即可。代码:#include #include #include usingnamespacestd; intmain(void) { intT;cin>>T; intn,m; while(T--){ cin>>n>>m; intcnt=0; intt; while(n!=m&&n&&
Yukizzz
·
2016-03-13 08:00
BestCoder Round #75 King's
Cake
模拟&&优化 || gcd
King'sCakeAccepts:967Submissions:1572TimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/65536K(Java/Others)ProblemDescriptionItistheking'sbirthdaybeforethemilitaryparade.Theministerspreparedarectangl
ProLightsfxjh
·
2016-03-12 22:00
模拟
ACM
round
Square
BestCoder
BestCoder Round #75 King's
Cake
模拟&&优化 || gcd
King'sCakeAccepts:967Submissions:1572TimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/65536K(Java/Others)ProblemDescriptionItistheking'sbirthdaybeforethemilitaryparade.Theministerspreparedarectangl
ProLightsfxjh
·
2016-03-12 22:00
模拟
ACM
round
Square
BestCoder
HDU 5640:King's
Cake
【几何】
King'sCakeTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):26 AcceptedSubmission(s):24ProblemDescriptionItistheking'sbirthdaybeforethemilitaryparade.The
lin14543
·
2016-03-12 21:00
HDU 5640 King's
Cake
Description一块蛋糕,每次只能切正方形,问最多能切多少块?Algorithm模拟切的过程,每次改变长宽Code#include usingnamespacestd; intmain() { intt; cin>>t; for(inti=0;i>n>>m; intans=0; while(n>0&&m>0) { if(n>m)n-=m;elsem-=n; ans++; } cout<
YYecust
·
2016-03-12 21:00
King's
Cake
ProblemDescriptionItistheking'sbirthdaybeforethemilitaryparade.Theministerspreparedarectanglecakeofsizen\timesm(1\len,m\le10000)n×m(1≤n,m≤10000).Thekingplanstocutthecakehimself.Buthehasastrangehabitof
weixinru4631260
·
2016-03-12 20:00
CF #343 div2 D Babaei and Birthday
Cake
dp+线段树维护+(离散)
话说应该也是到挺好做的题:题意:可以用一句话概括——–求最大值递增子序列(不是最长,是最大!)序列长度是100000,意味着普通的n*ndp是无法通过的。好,现在来回想一下最长递增子序列的dp算法:这个简单dp应该不难理解,就是对于每一个a[i],找到在i前面的j,既有a[i]>a[j]又有res[j]是最大值(也可以是最长的长度)! __int64LIS(){ __int64i,j,s,maxn
qq_24664053
·
2016-03-12 14:00
dp
【Scala】
Cake
模式和依赖注入
依赖注入(DependencyInjection)和控制反转(InversionofControl)DependencyInjection&InversionofControl是MartinFowler在2004年所提出來的一个概念,MartinFowler在这篇文章中指出,DI可以有三种形式来实现。这观念以后有Spring项目和Google实现出来,变成了JavaEnterprise应用中不可或
JasonDing
·
2016-03-11 22:54
【Scala】
Cake
模式和依赖注入
依赖注入(DependencyInjection)和控制反转(InversionofControl)DependencyInjection&InversionofControl是MartinFowler在2004年所提出來的一个概念,MartinFowler在这篇文章中指出,DI可以有三种形式来实现。这观念以后有Spring项目和Google实现出来,变成了JavaEnterprise应用中不可或
JasonDing
·
2016-03-11 22:54
【Scala】
Cake
模式和依赖注入
依赖注入(DependencyInjection)和控制反转(InversionofControl)DependencyInjection&InversionofControl是MartinFowler在2004年所提出來的一个概念,MartinFowler在这篇文章中指出,DI可以有三种形式来实现。这观念以后有Spring项目和Google实现出来,变成了JavaEnterprise应用中不可或
JasonDing1354
·
2016-03-11 22:00
scala
【Scala】
Cake
模式和依赖注入
依赖注入(DependencyInjection)和控制反转(InversionofControl)DependencyInjection&InversionofControl是MartinFowler在2004年所提出來的一个概念,MartinFowler在这篇文章中指出,DI可以有三种形式来实现。这观念以后有Spring项目和Google实现出来,变成了JavaEnterprise应用中不可或
JasonDing1354
·
2016-03-11 22:00
scala
scrollview中嵌套listview产生冲突问题
核心解决方案:重写listview和gridview的onMeasure方法如下:package come.
cake
.cu
czz4052644771
·
2016-03-09 08:17
自定义控件
scrollview中嵌套listview产生冲突问题
核心解决方案:重写listview和gridview的onMeasure方法如下:package come.
cake
.cu
czz4052644771
·
2016-03-09 08:17
自定义控件
Babaei and Birthday
Cake
(线段树+dp)
官方题解:首先,我们计算每个蛋糕的体积:vi=π∗hi∗r2i现在,考虑序列v1,v2,v3,…,vn:问题的答案是这个序列中递增子序列的最大和。我们怎么样解决它?首先去掉小数,我们可以定义一个新的数组 a1,a2,a3,…,an,ai=vi/π=hi∗r2i们考虑dpi是以ai结束的序列和的最大值且 dpi=max(ai,maxj #include #include #include #inc
rachelsg
·
2016-03-02 22:00
codeforces 629A Far Relative’s Birthday
Cake
A.FarRelative’sBirthdayCaketimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDoor'sfamilyisgoingcelebrateFamilDoors'sbirthdayparty.TheyloveFamilDoorsotheyarepl
非我非非我
·
2016-03-02 14:00
Codeforces 629D Babaei and Birthday
Cake
(树状数组优化dp)
题意:线段树做法分析:因为每次都是在当前位置的前缀区间查询最大值,所以可以直接用树状数组优化。比线段树快了12ms~代码:#include #include #include #include usingnamespacestd;//[) constintmaxn=100005,INF=0x3fffffff; #definepiacos(-1.0) typedeflonglongll; lldp[
Yukizzz
·
2016-03-01 20:00
Codeforces 629D Babaei and Birthday
Cake
(线段树优化dp)
题意:n个蛋糕编号从小到大编号,j号蛋糕可以放在i号上面,当且仅当j的体积严格大于i且i=0&&j #include #include #include usingnamespacestd;//[) constintmaxm=100005,maxn=maxmnum) update(num,x,k*2+1,l,mid); else update(num,x,k*2+2,mid,r); } llque
Yukizzz
·
2016-03-01 13:00
HDU 4344-Mark the Rope-大数素因子分解
7typedeflonglongll; 8constintINF=0x3f3f3f3f; 9constintmaxn=4e3+10; 10structcake 11{ 12intw,l; 13
cake
Helica
·
2016-02-29 23:00
CodeForces 589B-Layer
Cake
-暴力模拟
刚看到这个题的想法是建图搜路,写出来了才发现这个做法不行,不能把每一个矩形看成不可分的点,因为最终的矩形可能两条边出现在不同矩形里。后来看了题解才明白直接暴力就行。关键是明白最终的矩形两条边都在所给矩形中出现。1#include 2#include 3#include 4 5usingnamespacestd; 6 7typedeflonglongll; 8constintINF=0
Helica
·
2016-02-29 22:00
ZOJ 3537
Cake
区间DP。首先求凸包判断是否为凸多边形。如果是凸多边形:假设现在要切割连续的一段点,最外面两个一定是要切一刀的,内部怎么切达到最优解就是求子区间最优解,因此可以区间DP。#include #include #include #include #include usingnamespacestd; constintMAXN=1000; constintINF=0x7FFFFFFF;
Fighting_Heart
·
2016-02-28 10:00
Babaei and Birthday
Cake
(dp、BIT)
题意:给定N≤105个蛋糕,编号为1∼N,每个都有体积Vi任意一个蛋糕都可以放在桌子上,对于蛋糕对(i,j),i可以放在j上,当且仅当i>j且Vi≥Vj求能摆放的蛋糕的最大体积和分析:LIS模型的经典水题了f[i]表示第i个蛋糕在最上面的最大体积和f[i]=max{f[j]}+Vi,j #include #include #include #include #include #include #i
lwt36
·
2016-02-26 23:00
dp
Far Relative’s Birthday
Cake
(水~)
Description给出一个n*n的蛋糕,’C’表示巧克力,’.’表示空,如果任一行或者任一列有两个巧克力,小明的快乐度会加一,问小明的快乐度是多少Input第一行一整数n表示蛋糕尺寸,之后为一n*n矩阵表示该蛋糕(1 #include usingnamespacestd; #definemaxn111 intn; charm[maxn][maxn]; intmain() { while(~sc
V5ZSQ
·
2016-02-24 16:00
hdu 1722
Cake
思路:最大公约数 + 数学公式具体做法:p+q-gcd(p,q)至于为什么gcd(p,q)是两种切法的公共部分:可以这么考虑,k=gcd(p,q),1/k可以整除1/p和1/q,即将蛋糕切成k份,无论是切p份还是切q份都可以满足要求,切痕重合。#include #include usingnamespacestd; intgcd(intm,intn) { if(m%n==0)returnn; e
wchhlbt
·
2016-02-23 12:00
Codeforces 629D Babaei and Birthday
Cake
(DP)
D.BabaeiandBirthdayCaketimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAsyouknow,everybirthdaypartyhasacake!Thistime,Babaeiisgoingtopreparetheveryspecialbir
zwj1452267376
·
2016-02-23 02:00
Babaei and Birthday
Cake
dp+线段树优化,水题有几个要注意的地方,首先是注意到Pi可以提出来,所以不用double,降低进度误差;接着考虑提出来后会不会爆longlong,最大情况n*a[i]=n*r*r*h=1e5*1e4*1e4*1e4=1e17,显然不会,于是就可以愉快地用longlong了。。被自己蠢哭了。。。挂精度挂了半天居然没看出来这个。。。接着还是写下思路吧。。设dp[i]为以a[i]为结尾的可获得的最大体
__560
·
2016-02-21 22:00
Far Relative’s Birthday
Cake
A.FarRelative’sBirthdayCaketimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDoor'sfamilyisgoingcelebrateFamilDoors'sbirthdayparty.TheyloveFamilDoorsotheyarepl
helloiamclh
·
2016-02-21 21:00
Babaei and Birthday
Cake
(线段树+离散化优化DP)
题目链接:点击打开链接题意:给出n个圆柱体的地面半径和高,要求只能有一个直接放在桌子上,其他的要放在他上面,第i个能放在第j个上面的条件是:当且仅当第i个的体积大于第j个且ja[j])。 但是n非常大,显然要优化,因为第二层循环所做的事情就是在i之前找一个满足a[j]>a[i]的最大dp[j]。 那么为了同时满足两个条件,可以把其中一个条件(每个的体积)当成线段树下标,变相维护了一个条件,又因为小
weizhuwyzc000
·
2016-02-21 14:00
dp
线段树
离散化
codeforces
ACM-ICPC
Babaei and Birthday
Cake
(离散化+线段树)
D.BabaeiandBirthdayCaketimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAsyouknow,everybirthdaypartyhasacake!Thistime,Babaeiisgoingtopreparetheveryspecialbir
dml_96
·
2016-02-21 10:00
Babaei and Birthday
Cake
题目链接大意就是给出一个序列,然后让你从中找出一个严格递增的数列,使得这一数列里的值加起来最大。用线段树,先将数列里的值离散,然后就是线段树单点更新,区间查询最值。具体看代码。#include #include #include #include #include #include #include #include #include #include #include #i
yohaha
·
2016-02-21 08:00
Codeforces 629A Far Relative’s Birthday
Cake
题目:http://codeforces.com/contest/629代码:#include #include usingnamespacestd; charmaps[105][105]; longlongC(inta,intb) { longlongans=1; for(inti=0;i
qq_32473657
·
2016-02-21 08:00
Babaei and Birthday
Cake
线段树
题意:给你一些蛋糕的高度和半径,蛋糕是圆柱体的。每个蛋糕有编号1~n。一个人要放置一些蛋糕遵循以下规则,1.i只剩放在i之前的蛋糕的下边2.只能体积大的蛋糕放在体积小的蛋糕下面思路:就是最大上升子序列类似HDU1087不过数据比较大之前我们是通过双重for来跑,但是数据大的时候只能用线段树了先离散化成节点,然后就是普通线段树XXXX….心情无比sad比赛结束后四分钟才敲完,测完了交了一发A了Sad
qq_27925701
·
2016-02-21 03:00
codeforces
zoj3537
cake
【最优三角剖分+凸包】
CakeTimeLimit:1Second MemoryLimit:32768KBYouwanttoholdaparty.Here'sapolygon-shapedcakeonthetable.You'dliketocutthecakeintoseveraltriangle-shapedpartsfortheinvitedcomers.Youhaveaknifetocut.Thetraceo
zhou_yujia
·
2016-02-19 10:00
dp
ZOJ
hdu 1722
Cake
(公约数的应用和求法)
1)平分成q块需要切q刀,平分成p块需要p刀,两者都符合只需要剪去重复的那几刀即可(解题思路说明,我把问题想复杂了,应该简单、直接点去想怎样解决问题)#include usingnamespacestd; intgcd(intm,intn) { returnm==0?n:gcd(n%m,m);//gcd是公约数的简写 } intmain() { intp,q; while(scanf("%d%d
a272846945
·
2016-02-18 17:00
基础
ACM
UVA-1629
Cake
slicing (DP、记忆化搜索)
题目大意:一块n*m的矩形蛋糕,有k个草莓,现在要将蛋糕切开使每块蛋糕上都恰有一个(这意味着不能切出不含草莓的蛋糕块)草莓,要求只能水平切或竖直切,求最短的刀切长度。题目分析:定义状态dp(xa,ya,xb,yb)表示矩形左上角为(xa,ya)、右下角为(xb,yb)时需要切的最短长度。那么决策和状态转移方程就很显然了。 代码如下:#include #include #include #in
20143605
·
2016-02-18 14:00
【HDOJ】4328 Cut the
cake
将原问题转化为求完全由1组成的最大子矩阵。挺经典的通过dp将n^3转化为n^2。1/*4328*/ 2#include 3#include 4#include 5#include 6#include 7#include 8#include 9#include 10#include 11#include 12#include 13#include 14#include 1
Bombe
·
2016-02-10 22:00
ListView滑动删除
先上效果图:不知道是不是大家想要的效果,主页代码很简单:(MainActivity.java)packagecq.
cake
.dellistview; importandroid.os.Bu
xiaoshubing
·
2016-01-29 15:00
listview滑动删除
scrollview和listview或者gridview的冲突
核心解决方案:重写listview和gridview的onMeasure方法如下:package come.
cake
.cu
hanlaoshihao
·
2016-01-20 16:48
解决方案
super
content
scrollview和listview或者gridview的冲突
核心解决方案:重写listview和gridview的onMeasure方法如下:package come.
cake
.cu
hanlaoshihao
·
2016-01-20 16:48
super
解决方案
public
content
【杭电oj】1722 -
Cake
(数论,GCD)
CakeTimeLimit:1000/1000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):2914 AcceptedSubmission(s):1527ProblemDescription一次生日Party可能有p人或者q人参加,现准备有一个大蛋糕.问最少要将蛋糕切成多少块(每块大小不一
wyg1997
·
2016-01-17 20:00
ThinkPhp 01 ---用起来
一、配置:1.下载,解压2.新建项目目录
cake
3.将ThinkPhp解压后的ThinkPHP目录复制放到
cake
/下4.新建index.php在
cake
下:5.将httpd.conf的documentroot
kuki_iu
·
2016-01-16 19:00
Uva1629:
Cake
slicing
题目来源:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=51190解析:明显的是,各个不重叠的子矩阵切法之间没有相互关联。即:一个子矩阵的切总长最小,当且仅当它在“切一刀”后的所有状态中取最小值。不难想到这样的状态:设d[x1][y1]x2][y2]为子矩阵[x1~x2][y1~y2]切成每个蛋糕上一个桃的最小切割总长。则可
K_rew
·
2016-01-16 12:01
动态规划
RecyclerView的自适应高度
下面是Manager的自定义:packagecom.cq.
cake
.util
xiaoshubing
·
2015-12-29 10:00
Scalaz(15)- Monad:依赖注入-Reader besides
Cake
我们可以用MonadReader来实现依赖注入(dependencyinjectionDIorIOC)功能。Scala界中比较常用的不附加任何Framework的依赖注入方式可以说是CakePattern了。现在通过MonadReader可以实现同样功能,两者对比优点各有千秋。所谓依赖注入是指在编程时使用了某个未知实现细节的对象,但依赖注入确保这个对象在这段程序运行时已经实例化。这种需求通常是在
TIGER_XC
·
2015-11-27 19:00
编程
scala
functional
programmi
scalaz
Scalaz(15)- Monad:依赖注入-Reader besides
Cake
我们可以用MonadReader来实现依赖注入(dependencyinjectionDIorIOC)功能。Scala界中比较常用的不附加任何Framework的依赖注入方式可以说是CakePattern了。现在通过MonadReader可以实现同样功能,两者对比优点各有千秋。所谓依赖注入是指在编程时使用了某个未知实现细节的对象,但依赖注入确保这个对象在这段程序运行时已经实例化。这种需求通常是在
雪川大虫
·
2015-11-27 19:00
(๑ºั╰╯ºั๑)25
想要陪美女慧去1
cake
但是半途而废啦,有点事啦。回来吃鸡排啦,好吃好吃。反正有种感觉,就是慧,又不在我身边了。。好像被某个汉子带走了。。
柠檬不柠
·
2015-11-26 14:16
soj 3085 windy's
cake
V 单调栈的应用
http://acm.scu.edu.cn/soj/problem.action?id=3085单调栈:栈与单调性的结合。维护栈顶到栈底为单调增或减。可应用于求以a[i]为最值向左(右)扩展的最长长度,该区间内a[i]为最值。比如该题思路:则要求以a[i]为最小值的最长区间,运用一个l[i]来记录区间的左边界,r[i]来记录区间的右边界。本题维护一个栈顶到栈底递减的单调栈,l[i]为第一个小于a[
liujc_
·
2015-11-16 13:00
Java的结构之美【1】——构造对象
当我们遇到多个构造器參数的时候可能会想到用构件器,代码例如以下: /** * 构建器 * @author 阳光小强 * */ public class Lunch { private String
cake
·
2015-11-13 19:32
java
上一页
6
7
8
9
10
11
12
13
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他