Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- A unit cube is a 1 * 1 * 1 cube. And in a single cut you can move the knife only in one direction.
- Input
- 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.
- Output
- For each test case output one integer number - the minimum number of cuts.
- Example
- input
- 1
- 3 3 3
- output
- 6
Advertisement
Add Comment
Please, Sign In to add comment