codeforces C. Jzzhu and Chocolate
http://codeforces.com/contest/450/problem/C
题意:一个n×m的矩形,然后可以通过横着切竖着切,求切完k次之后最小矩形面积的最大值。
思路:设k1为横着切的次数,k2为竖着切的次数,最后的面积的大小为s=n/(k1+1)*(m/(k2+1)); 只有(k1+1)*(k2+1)的最小时,s最大.
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#define ll long long
using namespace std; ll n,m,k; int main()
{
cin>>n>>m>>k;
ll ans=;
if(k>(n-+m-))
{
printf("-1\n");
return ;
}
else
{
if(n->=k)
{
ans=max(ans,m*(n/(k+)));
}
else
{
ans=max(ans,m/(k-(n-)+));
}
if(m->=k)
{
ans=max(ans,n*(m/(k+)));
}
else
{
ans=max(ans,n/(k-m+));
}
}
cout<<ans<<endl;
return ;
}
codeforces C. Jzzhu and Chocolate的更多相关文章
- codeforces 450C. Jzzhu and Chocolate 解题报告(449A)
题目链接:http://codeforces.com/contest/450/problem/C 题目意思:给出一个 n * m 大小的chocolate bar,你需要在这个bar上切 k 刀,使得 ...
- Codeforces Round #257 (Div. 1)449A - Jzzhu and Chocolate(贪婪、数学)
主题链接:http://codeforces.com/problemset/problem/449/A ------------------------------------------------ ...
- Codeforces Round #257 (Div. 2) C. Jzzhu and Chocolate
C. Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standa ...
- Codeforces 450C:Jzzhu and Chocolate(贪心)
C. Jzzhu and Chocolate time limit per test: 1 seconds memory limit per test: 256 megabytes input: st ...
- CodeForces 450B Jzzhu and Sequences (矩阵优化)
CodeForces 450B Jzzhu and Sequences (矩阵优化) Description Jzzhu has invented a kind of sequences, they ...
- cf 450c Jzzhu and Chocolate
Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces C. Jzzhu and Cities(dijkstra最短路)
题目描述: Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- codeforces #257 C称号Jzzhu and Chocolate
职务地址:http://codeforces.com/contest/450/problem/C 这次CF的时候绝壁脑残了. ..A题和C题都出现了脑残失误... 唯一一个AC的B题还是被HACK了. ...
- Codeforces 450 C. Jzzhu and Chocolate
//area=(n*m)/ ((x+1)*(k-x+1)) //1: x==0; //2: x=n-1 //3: x=m-1 # include <stdio.h> long long m ...
随机推荐
- spring入门之helloworld
1.第一个spring例子 1.建立工程 建立一个java project就可以. 导包,helloworld包括下面两个最少的包: 到http://www.springsource.org/down ...
- 基于 CoreText 实现的高性能 UITableView
引起UITableView卡顿比较常见的原因有cell的层级过多.cell中有触发离屏渲染的代码(譬如:cornerRadius.maskToBounds 同时使用).像素是否对齐.是否使用UITab ...
- C#实现Ruby的负数索引器
public class InvertibleList<T> : List<T> { public new T this[int index] { get { ) return ...
- python 入门1
python的历史 Python是一种解释型.面向对象.动态数据类型的高级程序设计语言. Python由Guido van Rossum于1989年底发明,第一个公开发行版发行于1991年. 像Per ...
- SVN状态图标不显示
Windows最多只允许15个覆盖图标,它自己又用了几个,结果给用户用的就11个左右了,如果你安装了其他网盘,那可用的就更少了. 解决方法: 1.在运行里输入regedit进入注册表 2.依次打开HK ...
- Modem常用概念
真实设备的标识,即DEVICE_ID.比如,Android设备是手机,这个DEVICE_ID可以同通过TelephonyManager.getDeviceId()获取,它根据不同的手机设备返回IMEI ...
- 日文“表” php 会报错
php遇到很奇怪的问题,文字“表”会报错,并且是属于编译错误的问题. 单纯的输出: echo " 表 "; 会直接报错. 可是只要在中间加点东西,就可以解决这个问题,就算是空格都可 ...
- [访问系统] C#计算机信息类ComputerInfo (转载)
下载整个包,只下载现有类是不起作用的 http://www.sufeinet.com/thread-303-1-1.html 点击此处下载 using System; using System.Man ...
- Android - IOExceptionConnection to xxx refused.
还是stackoverflow上老外牛,往google上type一下,就找到原因了. 今天在使用Apache提供的HttpClient连接Tomcat服务器,使用log捕获异常的时候,提示说:IOEx ...
- c# ADO连接Access 执行Open后程序自动退出
今天利用ADO连接Access数据库的时候遇到了前所未见的问题,Access数据库连接串,OleDbConnection,open的时候,系统就会自动关闭所有调试. 我就很纠结了,这个AccessHe ...