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的更多相关文章

  1. codeforces 450C. Jzzhu and Chocolate 解题报告(449A)

    题目链接:http://codeforces.com/contest/450/problem/C 题目意思:给出一个 n * m 大小的chocolate bar,你需要在这个bar上切 k 刀,使得 ...

  2. Codeforces Round #257 (Div. 1)449A - Jzzhu and Chocolate(贪婪、数学)

    主题链接:http://codeforces.com/problemset/problem/449/A ------------------------------------------------ ...

  3. 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 ...

  4. Codeforces 450C:Jzzhu and Chocolate(贪心)

    C. Jzzhu and Chocolate time limit per test: 1 seconds memory limit per test: 256 megabytes input: st ...

  5. CodeForces 450B Jzzhu and Sequences (矩阵优化)

    CodeForces 450B Jzzhu and Sequences (矩阵优化) Description Jzzhu has invented a kind of sequences, they ...

  6. cf 450c Jzzhu and Chocolate

    Jzzhu and Chocolate time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. Codeforces C. Jzzhu and Cities(dijkstra最短路)

    题目描述: Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  8. codeforces #257 C称号Jzzhu and Chocolate

    职务地址:http://codeforces.com/contest/450/problem/C 这次CF的时候绝壁脑残了. ..A题和C题都出现了脑残失误... 唯一一个AC的B题还是被HACK了. ...

  9. 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 ...

随机推荐

  1. java Map使用Object 做为Key的问题

    近期在看dnsjava 源码的时候,不经意间发现一个自己没有想过的问题: HashMap 如何使用key去查找对应的value的,这个问题很难用语言描述的清楚,那就使用代码来进行说明吧! public ...

  2. MY_FAVOR_火埃及

  3. iOS UIKit:CollectionView之布局(2)

    Collection view使用UICollectionViewFlowLayout对象来管理section中的cell,该对象是一种流布局方式,即在collection view中的section ...

  4. 30种mysql优化sql语句查询的方法<转>

    转自百度文库 1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引.   2.应尽量避免在 where 子句中使用!=或<>操作符,否 ...

  5. .Net开源SqlServer ORM框架SqlSugar整理

    一.链接整理 官方Git源代码地址: https://github.com/sunkaixuan/SqlSugar 最新发布版更新地址:当前版本Release 3.5.2.1 https://gith ...

  6. C#缓存处理

    第一种方式: 在ASP.NET中页面缓存的使用方法非常的简单,只需要在aspx页的顶部加这样一句声明即可: <%@ OutputCache Duration="60" Var ...

  7. Ajax结合Js操作灵活操作表格

    Table页面: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head& ...

  8. ArcGIS JS Demo

    最近在用 ArcGIS 写了一个Demo 效果如下: 1. 引用 ArcGIS JS API arcgis_js_api/init.js 2. 引用 样式 arcgis_js_api/js/esri/ ...

  9. cocos2d-x系列 Mac下配置cocos2d-x开发环境(android和ios)

    一.下载cocos2d-x http://cocos2d-x.org/projects/cocos2d-x/wiki/Download cocos2d-x-2.1.4.zip @ June.18, 2 ...

  10. 《wc》-linux命令五分钟系列之十七

    本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...