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 ...
随机推荐
- TCP keepalive
2. TCP keepalive overview In order to understand what TCP keepalive (which we will just call keepa ...
- Strtus2标签之<s:url>
Strtus2标签<s:url> 在没有使用Struts2的时候可以使用el来进行url传参.而在Struts2中不推荐使用el(其实在Struts2.0.0.11之后就不再支持el)而推 ...
- 节点类(CCNode)
节点与渲染树 回顾前面的介绍,我们已经知道了精灵.层和场景如何构成一个游戏的框架.精灵属于层,层属于场景,玩家与精灵互动,并导致游戏画面在不同场景中切换.把每个环节拼接在一起,我们得到了一个完整的关系 ...
- sublime 2如何进入vim模式
点击菜单栏[Preferences]——[Settings - Defaults] 查找: "ignored_packages": ["Vintage"] 改为 ...
- Android源码编译过程之九鼎开发板
build_kernel() { # 进入源码顶层目录 cd ${BS_DIR_KERNEL} || # 编译配置文件 make ${BS_CONFIG_KERNEL} ARCH=arm CROSS_ ...
- [GDI+] C# ImageClass帮助类教程与源码下载 (转载)
点击下载 ImageClass.rar 功能如下图片 主要功能有:缩略图片,图片水印,文字水印,调整光暗,反色处理,浮雕处理,拉伸处理,左右翻转,上下翻转,压缩图片,图片灰度化,转换为黑白图片,获取图 ...
- 给右键 添加dos命令
reg add "HKEY_CURRENT_USER\Console" /v "ScreenBufferSize" /t REG_DWORD /d 655361 ...
- Jsoup解析HTML、加载文档等实例
一.引入jsoup的jar包:http://jsoup.org/download 补充:http://jsoup.org/apidocs/ Jsoup API 可以了解更详细的内容 二.Js ...
- UIAlertController使用的一个坑
/ // 创建一个确定按钮”一定要注意不能在提醒控制器的按钮的点击方法内部用到提醒控制器自己”,不能把下面这句话放在block内部”不然会死循环,导致警告控制器不能销毁" UITextFie ...
- Graphics类绘制图形
1. 画直线 void drawLine(int startX,int startY,int endX,int endY); 四个参数分别为:起始点的x坐标和y坐标以及终点的x坐标和y坐标,该方法用于 ...