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 ...
随机推荐
- MYSQL 系统命令 源码定位
sql_cmd.h enum enum_sql_command { SQLCOM_SELECT, SQLCOM_CREATE_TABLE, SQLCOM_CREATE_INDEX, SQLCOM_AL ...
- UDP 校检和和算法
#include <Winsock2.h> #include <stdio.h> #define IP_HDRINCL 2 // Header is included with ...
- SOA体系结构之基础培训教程-大纲篇
引言: 最近受邀做了一个企业的SOA体系结构的内训,本文是内训课程的培训大纲,分享一下吧,希望大家能够喜欢.同时也想针对大纲中列出的内容对SOA架构体系做一次回顾,如果时间允许把完整的课件也想放上来共 ...
- Android开发之使用意图调用内置应用程序
意图可以调用活动,也常被用来调用内置应用程序,如加载web页面,拨号页面,内置地图应用等等.下面就用例子来说明该用法. 效果图如下: 实现代码如下: 上图中的启动MyBrowser是用意图来调用MyW ...
- Node.js + Express + Mongodb 开发搭建个人网站(二)
二.路由 1.打开 routes/index.js ,这个意思就是 捕获到访问主页的get请求: 并通过 app.js 分配到对应的路由里: 看到这里,打开 http://127.0.0.1:300 ...
- 学习完毕-css
最近零零散散学习了css 最后附带链接,里面有css的全部demo.有空的可以练习练习,下一步 --->js -----http://www.w3cschool.cc/css/css-examp ...
- Java-hibernate的Hello World
hibernate 是对jdbc进行轻量级封装的 orm 框架,充当项目的持久层. 要使用 hibernate首先就需要继续配置, 引包:下载hibernate然后加入jar包 同时引入mysql ...
- Java SE (2)之 Graphics 画图工具
Graphics 绘图类: 提供两个方法.Paint (绘图,被系统自动调用) repaint(重绘) Paint 调用原理(1.窗口最大化,再最小化 窗口的大小发生变化 Repaint函数被调 ...
- VS2010无法打开CSS问题
安装了VS2010的SP1补丁后,发现打开css文件时出现下面问题: 一点击css文件就弹出:未能完成操作.未指定的错误.无法正常进入. [解决方法]安装最新Web Standards Update补 ...
- 一个自定义线程池的小Demo
在项目中如果是web请求时候,IIS会自动分配一个线程来进行处理,如果很多个应用程序共享公用一个IIS的时候,线程分配可能会出现一个问题(当然也是我的需求造成的) 之前在做项目的时候,有一个需求,就是 ...