思路
显然,最初有一块大巧克力,要手掰成 ,每次会增加 块,所以要掰 次。
刀切呢?只要每次从中间刀切后把两半叠起来切就行啦,长宽高都一样,答案就是 。
代码
# include <bits/stdc++.h>
# define I return
# define AK 0
# define IOI ;
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
int t, a, b, c;
int lg (int x) {
for (int i = 0;; ++ i)
if ((1 << i) >= x)
return i;
return -1;
}
int main () {
ios::sync_with_stdio (0);
cin.tie (0);
cout.tie (0);
cin >> t;
for (int ca = 1; ca <= t; ++ ca) {
cin >> a >> b >> c;
cout << "Case #" << ca << ": " << (ll) a*b*c - 1 << ' ' << lg (a) + lg (b) + lg (c) << '\n';
}
I AK IOI
}