#include <cstdio>
#include <cstring>
#include <iostream> using namespace std; int main()
{
int arry[] = {};
int now = ;
for(int i = ; i <= ; ++i)
{
now *= ;
arry[i] = now;
//printf("%d\t", arry[i]);
}
int t, casee = ;
//while(scanf("%d", &t) != EOF && (t > 0))
while(scanf("%d", &t) != EOF && (t > ))
{
for(int i = ; i <= ; ++i)
{
if(t == )
{
printf("Case %d: %d\n", casee++, );
break;
}
else if(t <= arry[i] && t > arry[i-])
{
printf("Case %d: %d\n", casee++, i);
}
}
}
}

Hello World!
Input: Standard Input

Output: Standard Output

When you first made the computer to print the sentence “Hello World!”, you felt so happy, not knowing how complex and interesting the world of programming and algorithm will turn out to be. Then you did not know anything about loops, so to print 7 lines of “Hello World!”, you just had to copy and paste some lines. If you were intelligent enough, you could make a code that prints “Hello World!” 7 times, using just 3 paste commands. Note that we are not interested about the number of copy commands required. A simple program that prints “Hello World!” is shown in Figure 1. By copying the single print statement and pasting it we get a program that prints two “Hello World!” lines. Then copying these two print statements and pasting them, we get a program that prints four “Hello World!” lines. Then copying three of these four statements and pasting them we can get a program that prints seven “Hello World!” lines (Figure 4). So three pastes commands are needed in total and Of course you are not allowed to delete any line after pasting. Given the number of “Hello World!” lines you need to print, you will have to find out the minimum number of pastes required to make that program from the origin program shown in Figure 1.

       

Figure 1

Figure 2

Figure3

Figure 4

Input

The input file can contain up to 2000 lines of inputs. Each line contains an integer N (0<N<10001) that denotes the number of “Hello World!” lines are required to be printed.

Input is terminated by a line containing a negative integer.

Output

For each line of input except the last one, produce one line of output of the form “Case X: Y” where X is the serial of output and Y denotes the minimum number of paste commands required to make a program that prints N lines of “Hello World!”.

 

 

Sample Input                             Output for Sample Input

2

10

-1

Case 1: 1

Case 2: 4

uva 11636的更多相关文章

  1. UVA.11636 Hello World! (思维题)

    UVA.11636 Hello World! (思维题) 题意分析 这题挺水的,还是错了几发. QWQ. 有一个同学打了一行hello world,现在他想打n行hello world,请问最少复制粘 ...

  2. 贪心水题。UVA 11636 Hello World,LA 3602 DNA Consensus String,UVA 10970 Big Chocolate,UVA 10340 All in All,UVA 11039 Building Designing

    UVA 11636 Hello World 二的幂答案就是二进制长度减1,不是二的幂答案就是是二进制长度. #include<cstdio> int main() { ; ){ ; ) r ...

  3. UVa 11636 - Hello World! 二分,水题 难度: 0

    题目 https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&a ...

  4. UVa 11636 (注意读题) Hello World!

    这道题巨坑啊,样例中以-1结束输入的,所以我就天真的以为测试数据也是以-1结束输入的 其实人家原文中说: Input is terminated by a line containing a nega ...

  5. UVA 11636 - Hello World! 水

    水题,贪心,dp都随意 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,ple ...

  6. UVA - 11636 Hello World! (贪心)

    思路:复制次数最少并且可以部分复制,那么贪心地让当前尽量多的复制,如果最后一次复制会超过n,那就部分复制.即满足并且x尽量小. AC代码 #include <stdio.h> const ...

  7. uva 11636 Hello World!

    https://vjudge.net/problem/UVA-11636 题意: 希望输出n条语句,但是并不会循环,所以只能复制粘贴,一条语句经过复制粘贴后可以变为2条,2条变成4条....每次可以只 ...

  8. 贪心,打表(或者快速幂), UVA - 11636

    题目链接: https://cn.vjudge.net/problem/34398/origin 题目比较简单,就是水题,基础贪心,大于所需的即可: AC代码: 打表: #include <cm ...

  9. UVa 11636 你好 世界!(贪心)

    https://vjudge.net/problem/UVA-11636 题意: 经过一次复制,一条语句会变成两条语句,再经过一次变成四条语句...求最少需要复制几次能使条数恰好为n? 思路: 贪心水 ...

随机推荐

  1. 对于类的双重调用的demo

    代码如下: package cao.com.duixiang; public class TestCCircle { public static void main(String[] args) { ...

  2. debug与release

    因为在Debug中有ASSERT断言保护,所以要崩溃,而在Release优化中就会删掉ASSERT,所以会出现正常运行. void func() {    char b[2]={0};    strc ...

  3. js函数的几个特殊点

    在ECMAScript中,Function(函数)类型实际上是对象.每个函数都是Function类型的实例,而且都与其他引用类型一样具有属性和方法.由于函数是对象,因此函数名实际上也是一个指向函数对象 ...

  4. php导出excel封装类

    因为实际情况的需要,导出excel表格在后台开发的过程中会经常用到.下面是我在实际应用中自己整理的一个导出excel类,需要PHPExcel支持,本类很好的完成导出表格的基本样式,保存路径,切换工作薄 ...

  5. myaql常用函数

    一.数学函数 abs(x)   返回x的绝对值 bin(x)   返回x的二进制(oct返回八进制,hex返回十六进制) ceiling(x)   返回大于x的最小整数值 exp(x)   返回值e( ...

  6. 在python3.5下安装scrapy包

    此前scrapy只支持python2.x 但是最新的1.1.0rc1已结开始支持py3了 如果电脑上安装了scrapy的依赖包,诸如lxml.OpenSSL 1.你直接下载Scrapy-1.1.0rc ...

  7. 栈与队列:refresh的停车场

    数据结构实验之队列一:排队买饭 Time Limit: 1000MS Memory limit: 65536K 题目描述 中午买饭的人特多,食堂真是太拥挤了,买个饭费劲,理工大的小孩还是很聪明的,直接 ...

  8. Tiny Rss Reader - 迷你RSS阅读器

    发布新软件 TinyRss: Windows平台上的一个小巧的Rss阅读器. 用户界面: 项目地址: https://github.com/movsb/tinyrss.git 测试下载: http:/ ...

  9. 恢复 git reset -hard 的误操作

    有时候使用Git工作得小心翼翼,特别是涉及到一些高级操作,例如 reset, rebase 和 merge.甚至一些很小的操作,例如删除一个分支,我都担心数据丢失. 不 久之前,我在做一些大动作(re ...

  10. Android之Adapter用法总结(转)

    Android之Adapter用法总结 1.概念 Adapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带.在常见的View(List View,Grid Vie ...