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 ...
随机推荐
- 一次向svn中增加所有新增文件 svn add all new files
svn st | grep '^\?' | tr '^\?' ' ' | sed 's/[ ]*//' | sed 's/[ ]/\\ /g' | xargs svn add
- iOS UIKit:animation
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css); @import url(/ ...
- android js 互调
public class BoatsActivity extends Activity { Handler mHandler = new Handler();//处理消息的handler @Suppr ...
- centos 安装mysqldb 记录
vim setup_pofix.py #修改mysql_config路径 <pre> ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /us ...
- css3遇到的一些属性
rgba 是由red.green.blue 三种颜色搭配出来的box-shadow 向元素添加阴影层,水平阴影位置,垂直阴影位置,后面是可选:模糊距离,阴影大小,颜色,是否是 ...
- PHP in_array不兼容问题
做过日本的手机端,就因为in_array这个方法在我的环境下没有问题 结果到日本那边就是出问题,一直纠结的我啊,现在特贴出当初的兼容方法 function in_into($key,$array){ ...
- webrtc学习———记录一
最近导师让研究一下webrtc,希望将来用到我们的ICT2系统中. 但是从来没有过做web的基础,无论前端还是后端,html.js全都从头学起.html还好说,没有太过复杂的东西. js就有点难度了, ...
- asp.net各种获取客户端ip方法
Request.ServerVariables("REMOTE_ADDR") 来取得客户端的IP地址,但如果客户端是使用代理服务器来访问,那取到的就是代理服务器的IP地址,而不是真 ...
- Android Studio SDK Manager无法正常下载如何设置
博客分类: Linux 零散小知识 Android那点事 AndroidStudioSDKManager 一方面在/etc/hosts中设置: #Google主页 203.208.46.146 ww ...
- oracle 权限管理
系统权限 系统权限需要授予者有进行系统级活动的能力,如连接数据库,更改用户会话.建立表或建立用户等等.你可以在数据字典视图SYSTEM_PRIVILEGE_MAP上获得完整的系统权限.对象权限和系统权 ...