uva 11636Hello World!

简介: 点击打开链接uva11636 水题 #include#include#include#includeusing namespace std;int solve(int n){ int ans = 0; int ...

点击打开链接uva11636

水题

#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;
}




目录
相关文章
|
算法
uva 10891 game of sum
题目链接 详细请参考刘汝佳《算法竞赛入门经典训练指南》 p67
33 0
UVa11076 - Add Again
UVa11076 - Add Again
56 0
UVa343 What Base Is This
UVa343 What Base Is This
49 0
UVA 11636-Hello World!(水题,猜结论)
UVA11636-Hello World! Time limit: 1.000 seconds When you first made the computer to print the sentence “Hello World!”, you felt so happy, not knowing...
1127 0
|
机器学习/深度学习 算法
【OJ】Ants acmclub.com 10913 // poj 1852
#include #include #include using namespace std; int shu[1000010]; int main(){ int i,a,b; while(scanf("%d %d",&a,&b)!=EOF){ for(...
859 0
|
数据安全/隐私保护
下一篇
DataWorks