Codeforces #710 - Strange Table
/* Solving concept: I have first found the position of x in "by columns": This is note that the position is started from 1. So, if(x % n == 0) then, row = n, col = x / n; else row = x % n, col = (x / n) + 1; This is an easy technique. Mind that: you can not run any loop to find the position because of the large number of input and test cases. Now, find, what will be value for that position (row, col) in "by rows": Look, in "by rows" method - a number will be increased sequentially in side of a row. For example: consider 3x5 matrix - 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 there should have exact 15 numbers/values. So, what will be value of (...