当前位置:网站首页>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
边栏推荐
- Code neat way to learn
- 線性代數第一章-行列式
- Create binary tree
- Pytorch learning record (7): skills in processing data and training models
- sklearn之 Gaussian Processes
- 线性代数第三章-矩阵的初等变换与线性方程组
- JDBC tool class encapsulation
- Traitement des séquelles du flux de Tensor - exemple simple d'enregistrement de torche. Utils. Données. Dataset. Problème de dimension de l'image lors de la réécriture de l'ensemble de données
- Gaussian processes of sklearn
- Anaconda
猜你喜欢

A sharp tool to improve work efficiency

Pytorch学习记录(十三):循环神经网络((Recurrent Neural Network)
Best practices for MySQL storage time

Pytorch学习记录(七):处理数据和训练模型的技巧

Pytorch learning record (III): structure of neural network + using sequential and module to define the model

Multithreading and high concurrency (3) -- synchronized principle

Pytoch learning record (x): data preprocessing + batch normalization (BN)

A general U-shaped transformer for image restoration

Pytorch notes - complete code for linear regression & manual or automatic calculation of gradient code comparison

Pytorch学习记录(五):反向传播+基于梯度的优化器(SGD,Adagrad,RMSporp,Adam)
随机推荐
给yarn配置国内镜像加速器
JSP syntax and JSTL tag
DBCP usage
Pyqy5 learning (III): qlineedit + qtextedit
Shansi Valley P290 polymorphism exercise
Pytorch学习记录(十):数据预处理+Batch Normalization批处理(BN)
MySQL basic madness theory
Pyqy5 learning (2): qmainwindow + QWidget + qlabel
Why does the subscript of the array start from 0 instead of 1?
Framework analysis 2 Source code - login authentication
JDBC tool class encapsulation
ValueError: loaded state dict contains a parameter group that doesn‘t match the size of optimizer‘s
Solve the error: importerror: iprogress not found Please update jupyter and ipywidgets
PHP processing JSON_ Decode() parses JSON stringify
数字图像处理基础(冈萨雷斯)一
Denoising paper - [noise2void, cvpr19] noise2void learning denoising from single noise images
编程记录——图片旋转函数scipy.ndimage.rotate()的简单使用和效果观察
对比学习论文——[MoCo,CVPR2020]Momentum Contrast for Unsupervised Visual Representation Learning
图像恢复论文简记——Uformer: A General U-Shaped Transformer for Image Restoration
Pytorch notes - observe dataloader & build lenet with torch to process cifar-10 complete code