ITRIX_E - THE BLACK AND WHITE QUEENS
Subru and Shanmu are playing Chess. Shanmu wonder about queens . So he asked Subru the following question
“How many ways are there to place a black and a white Queen on an M * N chessboard such that they do not attack each other? The queen can be moved any number of unoccupied squares in a straight line vertically, horizontally, or diagonally..”
Subru gave the answer in seconds for a given chess board of size M x N (M<=N). Can you repeat the same with Your Code?
The first line contains the integer “t” which indicates the number of test cases. Each of the following t lines contains two integers M and N separated by spaces (M<=N).
Output for each case consists of one line: The number of ways of placing a black and a white queen on a M x N chess board such that they do not attack each other.
Constraints: T<=10000 , 2<=M <=10^10 (10 power 10 ) ,2<=N<=10^10 (10 power 10). And M<=N .
Is long long in C is enough?