当前位置:网站首页>7.Domino piling
7.Domino piling
2022-04-23 06:08:00 【linsa_ pursuer】
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
package com;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
while (s.hasNextInt()){
System.out.println((s.nextInt()*s.nextInt())/2);
}
}
}
版权声明
本文为[linsa_ pursuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220533259766.html
边栏推荐
- 如何利用对比学习做无监督——[CVPR22]Deraining&[ECCV20]Image Translation
- Supply chain service terms
- Multithreading and high concurrency (3) -- synchronized principle
- LDCT图像重建论文——Eformer: Edge Enhancement based Transformer for Medical Image Denoising
- JDBC operation transaction
- Reading of denoising paper - [ridnet, iccv19] real image denoising with feature attention
- 线性代数第一章-行列式
- lambda expressions
- Remedy after postfix becomes a spam transit station
- Pytorch learning record (IX): convolutional neural network in pytorch
猜你喜欢
Development environment EAS login license modification
PyQy5学习(四):QAbstractButton+QRadioButton+QCheckBox
卡尔曼滤波与惯性组合导航
Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
Chapter 4 of line generation - linear correlation of vector systems
Pytorch notes - complete code for linear regression & manual or automatic calculation of gradient code comparison
Pyemd installation and simple use
Multithreading and high concurrency (1) -- basic knowledge of threads (implementation, common methods, state)
无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising
PyTorch笔记——实现线性回归完整代码&手动或自动计算梯度代码对比
随机推荐
A general U-shaped transformer for image restoration
EditorConfig
线代第四章-向量组的线性相关
无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising
Reading of denoising papers - [cvpr2022] blind2blind: self supervised image denoising with visible blind spots
Conda 虚拟环境管理(创建、删除、克隆、重命名、导出和导入)
Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.
常用编程记录——parser = argparse.ArgumentParser()
container
Latex快速入门
Pytorch学习记录(五):反向传播+基于梯度的优化器(SGD,Adagrad,RMSporp,Adam)
Numpy common function table sorting of data processing
Shansi Valley P290 polymorphism exercise
How does MySQL convert stored seconds into dates
Kingdee EAS "general ledger" system calls "de posting" button
Explain of MySQL optimization
编写一个自己的 RedisTemplate
Pytorch學習記錄(十三):循環神經網絡((Recurrent Neural Network)
自动控制(韩敏版)
Pytorch学习记录(十):数据预处理+Batch Normalization批处理(BN)