C - Domino piling
Problem description
You are given a rectangular board of M × N squares. Also you are given an unlimited number of standard domino pieces of 2 × 1 squares. You are allowed to rotate the pieces. You are asked to place as many dominoes as possible on the board so as to meet the following conditions:
1. Each domino completely covers two squares.
2. No two dominoes overlap.
3. Each domino lies entirely inside the board. It is allowed to touch the edges of the board.
Find the maximum number of dominoes, which can be placed under these restrictions.
Input
In a single line you are given two integers M and N — board sizes in squares (1 ≤ M ≤ N ≤ 16).
Output
Output one number — the maximal number of dominoes, which can be placed.
Examples
Input
2 4
Output
4
Input
3 3
Output
4
解题思路:题目很简单,要求在一个m*n的矩形中用一张2*1的扑克牌按方格尽量铺满,并且不能超过矩形界限但可以贴着矩形边缘,直接取矩形面积的一半即可,水过!
AC代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int m,n;
cin>>m>>n;
cout<<(m*n/)<<endl;
return ;
}
C - Domino piling的更多相关文章
- CodeForces - 50A Domino piling (贪心+递归)
CodeForces - 50A Domino piling (贪心+递归) 题意分析 奇数*偶数=偶数,如果两个都为奇数,最小的奇数-1递归求解,知道两个数都为1,返回0. 代码 #include ...
- codeforces水题100道 第三题 Codeforces Beta Round #47 A. Domino piling (math)
题目链接:http://www.codeforces.com/problemset/problem/50/A题意:一个NxM的举行中最多能放多少个1x2的矩形.C++代码: #include < ...
- codeforcess水题100道
之所以在codeforces上找这100道水题的原因是为了巩固我对最近学的编程语言的掌握程度. 找的方式在codeforces上的PROBLEMSET中过的题最多的那些题里面出现的最前面的10个题型, ...
- Codeforces初体验
Codeforces印象 这两天抽时间去codeforces体验了一把. 首先,果然有众多大牛存在.非常多名人一直參加每周一次的比赛.积分2000+,并參与出题. 另外.上面题目非常多.预计至少一千题 ...
- BPM Domino集成解决方案
一.需求分析 Lotus Notes/Domino是IBM的协同办公平台,在国内有广泛的用户. 但由于推出年头较早.采用文档数据库等特点, 导致其流程集成能力弱.统计分析难.不支持移动办公等问题,很多 ...
- 【转载】给那些想多学习,多进步的Domino初学者
在这个社区里面,包括QQ技术群里面混了很久了.遇到了很多Domino初学者,也认识了很多致力于Domino这个技术领域的朋友,很开心.很久没有写长篇大论给大家了.我要把一些想法写出来,共大家参考.讨论 ...
- FineReport中Domino数据库连接方法
1. 概述 Domino是文档型数据库而非关系型数据库,连接Domino可以使用JDBC方式或者ODBC方式,使用JDBC方式需要安装Lotus Domino Driver for JDBC并且此方法 ...
- IBM Domino 9 出现 Server Controller 未在主机上运行或未在端口2050监听 解决方案
如果在网上搜索的方法,比如防火墙开端口还没有解决的话,那么我的解决方案可能会解决你的问题. 出现的场景: 我先装了Notes,Designer,后装Domino Server, 配置Domino服务器 ...
- CF 405B Domino Effect(想法题)
题目链接: 传送门 Domino Effect time limit per test:1 second memory limit per test:256 megabytes Descrip ...
随机推荐
- IE浏览器new Date()带参返回NaN解决方法
var start = '2016-01-01 12:12:12'; var date = new Date(start); 得到的时间为NaN: 解决方法: 1.自定义方法 自定义一个NewDate ...
- eas之列表界面写脚本时如何写sql
var easNames = JavaImporter();easNames.importPackage(Packages.com.kingdee.bos.dao.query);with(easNam ...
- cogs——66. [HAOI2004模拟] 数列问题
66. [HAOI2004模拟] 数列问题 本以为会TLE,可... dfs水题(很基础) #include<bits/stdc++.h> using namespace std; ],a ...
- Map的两种遍历方式
********************************************************************************* ****************** ...
- 3.2.1 for循环与while循环的基本语法
不停地重复一件事情,时间久了会非常无聊,然后大脑就会由于疲劳而容易入睡. 重复性的劳动会使人疲劳,而计算机不会,只要代码写得正确,计算机就会孜孜不倦地重复工作.在Python中主要有两种形式的循环结构 ...
- springcloud(四):Eureka客户端公共组件打包方式
, 一.前言 各位大佬应该知道,在大型项目中都需要有数据传输层,一般项目都采用的是MVC结构,如果有10个表,则会创建10个实体类,在各个层之间应该使用实体类传递数据: 在微服架构中,也许 ...
- 【CodeCraft-19 and Codeforces Round #537 (Div. 2) C】Creative Snap
[链接] 我是链接,点我呀:) [题意] 横坐标1..2^n对应着2^n个复仇者的基地,上面有k个复仇者(位置依次给出). 你是灭霸你要用以下方法消灭这k个复仇者: 一开始你获取整个区间[1..2^n ...
- java中redis的分布式锁工具类
使用方式 try { if(PublicLock.getLock(lockKey)){ //这里写代码逻辑,执行完后需要释放锁 PublicLock.freeLock(lockKey); } } ca ...
- Debug : array type has incomplete element type
array type has incomplete element type extern struct SoundReport SoundList[32]; ///// 多写了 st ...
- Java下用Jackson进行JSON序列化和反序列化(转)
Java下常见的Json类库有Gson.JSON-lib和Jackson等,Jackson相对来说比较高效,在项目中主要使用Jackson进行JSON和Java对象转换,下面给出一些Jackson的J ...