andreahmed

Untitled

Dec 11th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. How many cuts are needed to cut a A x B x C cuboid into unit cubes? After each cut you are allowed to rearrange the parts in a way you like, so you may cut several parts in one action.
  2.  
  3. A unit cube is a 1 * 1 * 1 cube. And in a single cut you can move the knife only in one direction.
  4.  
  5. Input
  6. The input file contains t (1 ≤ t ≤ 1024) test cases. Each test case consist of 3 integers A, B and C (1 ≤ A, B, C ≤ 1018)in a single line.
  7.  
  8. Output
  9. For each test case output one integer number - the minimum number of cuts.
  10.  
  11. Example
  12. input
  13. 1
  14. 3 3 3
  15. output
  16. 6
Advertisement
Add Comment
Please, Sign In to add comment