HDU 5100 Chessboard(暴力)
2016-04-08 16:14
351 查看
给出一个n*n的放个 问用1*k的长条覆盖他 最多能覆盖几个格子
#include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cmath> #include<string.h> #include<cstring> #include<string> #include<map> #include<set> #include<vector> #include<queue> #include <stack> //#include<bits/stdc++.h> #define MAXN 1000005 #define MAXV 10005 #define ssp system("pause") using namespace std; typedef long long ll; int main() { int T; cin >> T; while (T--) { ll n, k; cin >> n >> k; if (k > n){ cout << "0\n"; continue; } ll mo = n%k; if (k / 2 >= mo)cout << n*n - mo*mo << "\n"; else cout << n*n - (k - mo) *(k - mo)<<"\n"; } return 0; }
相关文章推荐
- 卸载CentOS7-x64自带的OpenJDK并安装Sun的JDK8的方法
- 『NYIST』第九届河南省ACM竞赛队伍选拔赛[正式赛二]--Codeforces -35D. Animals
- Android图片加载Glide框架使用详解
- 【转帖】Service Discovery: 6 questions to 4 experts
- ASP创建多级无限文件夹
- c3p0源码解析 二 (DriverManagerDataSource类)
- 最长公共子序列(Python)
- 享元模式
- 简单说说TCP(2) --- 数据传输
- 自制BaseServlet
- 你想建设一个能承受500万PV/每天的网站吗?
- UVA_104_Arbitrage
- 欧拉环、欧拉路径的判定和求法
- 面试问题,将字符串、字符串单词倒叙输出
- 泛型依赖注入
- WKNavigationDelegate调用的顺序
- Hadoop和spark通信机制
- 在竞赛ACM Java处理输入输出
- linux下安装mongodb3.2.4
- 数组分段查找