水题
#include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int solve(int n){ int ans = 0; int num = 1; while(num < n){ ans++; num *= 2; } return ans; } int main(){ int Case = 1 , n; while(scanf("%d" , &n) && n > 0) printf("Case %d: %d\n" , Case++ , solve(n)); return 0; }
时间: 2024-09-27 11:47:12