시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
30 초 (추가 시간 없음) | 1024 MB | 36 | 22 | 20 | 64.516% |
Wheatley is at the best party in the world: it has infinitely many cakes! Each cake is a square with an integer side length (in cm). The party has infinitely many cakes of every possible integer side length. The cakes all have the same depth, so we will only consider their areas.
Wheatley is determined to eat one or more cakes that have a total combined area of exactly N cm2. But, since he is health-conscious, he wants to eat as few cakes as possible. Can you help him calculate the minimum number of cakes he can eat?
The input starts with one line containing one integer T, which is the number of test cases. T test cases follow. Each case consists of one line with one integer N, which is the exact total cake area that Wheatley wants to eat.
For each test case, output one line containing Case #x: y
, where x
is the test case number (starting from 1) and y
is the minimum number of cakes that Wheatley can eat while eating the exact total area N.
3 3 4 5
Case #1: 3 Case #2: 1 Case #3: 2
In Sample Case #1, the only possible strategy is for Wheatley to eat three cakes of side length 1.
In Sample Case #2, Wheatley can eat one cake of side length 2, which requires fewer cakes than eating four cakes of side length 1.
In Sample Case #3, the best strategy is for Wheatley to eat one cake of side length 2 and one cake of side length 1.
Contest > Google > Kick Start > Google Kick Start 2017 > Round F A번