MATRIX67大神:   http://www.matrix67.com/blog/archives/5900

Chessboard

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 538    Accepted Submission(s): 241

Problem Description
Consider the problem of tiling an n×n chessboard by polyomino pieces that are k×1 in size; Every one of the k pieces of each polyomino tile must align exactly with one of the chessboard squares. Your task is to figure out the maximum number of chessboard squares tiled.
Input
There are multiple test cases in the input file.
First line contain the number of cases T ( T≤10000 ). 
In the next T lines contain T cases , Each case has two integers n and k. ( 1≤n,k≤100 )
Output
Print the maximum number of chessboard squares tiled.
Sample Input
  
2 6 3 5 3
Sample Output
  
36 24
Source
BestCoder Round #17
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>using namespace std;int main()
{int T_T;int n,k;scanf("%d",&T_T);while(T_T--){scanf("%d%d",&n,&k);if(k>n){puts("0");continue;}int r=n%k;if(r>k/2) r=k-r;printf("%d\n",n*n-r*r);}return 0;
}

HDOJ 5100 Chessboard 构造相关推荐

  1. 构造 HDOJ 5400 Arithmetic Sequence

    题目传送门 题意:问有多少个区间,其中存在j使得ai + d1 == ai+1(i<j) && ai + d2 == ai+1 (i>j) 构造:用c1[i], c2[i] ...

  2. hdu 5100 n*n棋盘放k*1长方条最多覆盖面积

    http://acm.hdu.edu.cn/showproblem.php?pid=5100 给一个n*n的棋盘,问用k*1的长方条最多能覆盖多大的面积(k个单位都必须完全覆盖上去) 首先,若n< ...

  3. 【HDOJ图论题集】【转】

    1 =============================以下是最小生成树+并查集====================================== 2 [HDU] 3 1213 How ...

  4. AT3968-[AGC025E] Walking on a Tree【构造】

    正题 题目链接:https://www.luogu.com.cn/problem/AT3968 题目大意 给出nnn个点的一棵树,然后给出mmm条路径.每条边的权值是它是否又被正向经过+是否又被反向经 ...

  5. 软件构造Lab2-Playing Chess

    软件构造Lab2-Playing Chess ADT设计/实现方案 主程序MyChessAndGoGame设计/实现方案 ADT设计/实现方案 对于Player.Board.Piece.Action都 ...

  6. HIT 软件构造 lab2

    1 实验目标概述··· 1 2 实验环境配置··· 1 3 实验过程··· 1 3.1 Poetic Walks· 1 3.1.1 Get the code and prepare Git repos ...

  7. 软件构造lab2 - 实验报告

    软件构造lab2 - 实验报告 1.实验目标概述 2.环境配置 3.实验过程 3.1Poetic Walks 3.1.1Get the code and prepare Git repository ...

  8. 2020春软件构造Lab2 ADT and OOP

    ADT and OOP 1 实验目标概述 2 实验环境配置 3 实验过程 3.1 Poetic Walks 3.1.1 Get the code and prepare Git repository ...

  9. 软件构造Lab2-实验报告

    实验目标概述 本次实验训练抽象数据类型(ADT)的设计.规约.测试,并使用面向对象编程(OOP)技术实现ADT.具体来说: ⚫ 针对给定的应用问题,从问题描述中识别所需的ADT: ⚫ 设计ADT规约( ...

最新文章

  1. 使用canvas实现数据可视化
  2. Visual Studio“15”进一步改善性能和易用性
  3. 输入框值不能赋值成功
  4. MySQL binlog_format (Mixed,Statement,Row)
  5. pc端滚动去掉滚动条scroll
  6. 下载MDK5 Software Packs导入Keil5
  7. 《动手学深度学习》网页版
  8. NeurIPS2020 Generalized Focal Loss论文翻译
  9. 51单片机ADDA数模转换
  10. rls最小二乘法 c语言,RLS递归最小二乘(最新整理)
  11. 山寨凤凰新闻菜单效果
  12. 面对不同种类的处理结果——result type=
  13. 大话成像之《图像质量测试测量与国际标准》课程
  14. 蚂蚁金融科技守护金融安全,蚂蚁风险大脑助阵 1
  15. ZUCC_Linux系统管理_实验五 计划任务
  16. 操作记录-2020-11-08:精简代码处理RNA_seq数据
  17. C语言结构体和链表结合,C语言结构体与链表
  18. Stata的DOS命令
  19. php提取网页mp3,怎么提取网页中的音乐|下载网页中的音乐 网页音乐提取工具及使用教程分享...
  20. 基于web的c语言在线编译器的设计步骤,定稿毕业论文基于WEB的C语言在线学习系统毕业设计完整版(范文1)...

热门文章

  1. 无线宽带好用吗?有哪些优势?
  2. 非奇异矩阵的多种判断方式
  3. android lunch 选择写入脚本,Android源码编译之 lunch命令分析及user和userdebug编译选项区别...
  4. 1、用Keil5开发TM4C123G单片机的软件准备
  5. 【Java】Java中Pair的使用
  6. 数据价值深度挖掘,分析服务上线“探索”能力
  7. dz邮箱验证怎么设置_详细步骤!Discuz如何设置通过 SOCKET 连接 SMTP 服务器发送(支持 ESMTP 验证)实现论坛邮箱验证功能...
  8. VMware 17 Pro安装(升级)
  9. 85-决策树解决回归问题
  10. 正则表达式匹配任意字符(包括换行符)