UVa 11636 - Hello World!
代码
#include <bits/stdc++.h>
#define LL long long
#define lowbit(x) ((x) & (-x))
const int MAXN = 30 + 5;
const int INF = 0x3f3f3f3f;
using namespace std;
int main()
{
//freopen("input.txt", "r", stdin);
int T, i, j, cases = 0, n;
while (scanf("%d", &n), n >= 0)
{
printf("Case %d: ", ++cases);
int use = 1, cnt = 0;
while (1)
{
if (n <= use)
break;
use <<= 1;
cnt++;
}
printf("%d\n", cnt);
}
return 0;
}