MATRIX67 Great god: http://www.matrix67.com/blog/archives/5900
ChessboardTime
limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 538 Accepted Submission (s): 241
Problem Descriptionconsider The problem of tiling an nxn chessboard by polyomino pieces that is kx1 in size; Every one of the k pieces of each polyomino tiles must align exactly with one of the chessboard squares. Your task is to figure out the maximum number of chessboard squares tiled.
Inputthere is 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 both integers n and K. ( 1≤n,k≤ )
Outputprint the maximum number of chessboard squares tiled.
Sample Input
26 35 3
Sample Output
3624
Sourcebestcoder 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 Structure