您的位置:首页 > 其它

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: