这道题巨坑啊,样例中以-1结束输入的,所以我就天真的以为测试数据也是以-1结束输入的

其实人家原文中说:

Input is terminated by a line containing a negative integer.

是以负数结束输入,囧rz!

我这种英语渣渣,怎么可能注意到这种错误

我还以为是算法的问题,就写了两份代码

 //#define LOCAL
#include <cstdio> int a[]; int main(void)
{
#ifdef LOCAL
freopen("11636in.txt", "r", stdin);
#endif int n, kase = , j = ;
for(int i = ; i <= ; ++i)
{
while(j <= ( << i))
{
a[j++] = i;
if(j > ) break;
}
if(j > ) break;
}
while(scanf("%d", &n))
{
if(n < ) break;
printf("Case %d: %d\n", ++kase, a[n]);
}
return ;
}

代码君一

 //#define LOCAL
#include <cstdio> int main(void)
{
#ifdef LOCAL
freopen("11636in.txt", "r", stdin);
#endif int n, kase = ;
while(scanf("%d", &n) == )
{
if(n < ) break;
--n;
int cnt = ;
while(n) { n >>= ; ++cnt; }
printf("Case %d: %d\n", ++kase, cnt);
}
return ;
}

代码君二

UVa 11636 (注意读题) Hello World!的更多相关文章

  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 489 HangmanJudge --- 水题

    UVa 489 题目大意:计算机给定一个单词让你猜,你猜一个字母,若单词中存在你猜测的字母,则会显示出来,否则算出错, 你最多只能出错7次(第6次错还能继续猜,第7次错就算你失败),另注意猜一个已经猜 ...

  4. UVa 1585 Score --- 水题

    题目大意:给出一个由O和X组成的串(长度为1-80),统计得分. 每个O的分数为目前连续出现的O的个数,例如,OOXXOXXOOO的得分为1+2+0+0+1+0+0+1+2+3 解题思路:用一个变量t ...

  5. 杭电ACM2076--夹角有多大(题目已修改,注意读题)

    杭电ACM2076--夹角有多大(题目已修改,注意读题) http://acm.hdu.edu.cn/showproblem.php?pid=2076 思路很简单.直接贴代码.过程分析有点耗时间. / ...

  6. 【托业】【全真题库】TEST01-03-阅读题

    [托业][全真题库]TEST01-03-阅读题

  7. HDUOJ--2079选课时间(题目已修改,注意读题)

    选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  8. hdu 3268 09 宁波 现场 I - Columbus’s bargain 读题 最短路 难度:1

    Description On the evening of 3 August 1492, Christopher Columbus departed from Palos de la Frontera ...

  9. Codeforces 61B【怪在读题】

    搞不懂为什么DFS的写法崩了,然后乱暴力,因为题意不是很懂... 主要还是读题吧(很烦 #include <bits/stdc++.h> using namespace std; type ...

随机推荐

  1. 一个利用window.name实现的windowStorage

    //key:value|key:value var windowStorage = { _inited: false, _data: {}, init: function(str) { var tmp ...

  2. oracle impdp的table_exists_action详解

    oracle impdp的table_exists_action详解 分类: [oracle]--[备份与恢复]2012-01-06 22:44 9105人阅读 评论(0) 收藏 举报 tableac ...

  3. 游戏引擎网络开发者的64做与不做(二A):协议与API

    [编者按]在这个系列之前的文章"游戏引擎网络开发者的64做与不做(一):客户端方面"中,Sergey介绍了游戏引擎添加网络支持时在客户端方面的注意点.本文,Sergey则将结合实战 ...

  4. 图解JavaScript执行环境结构

    JavaScript引擎在开始编译代码的时候,会对JavaScript代码进行一次预编译,生成一个执行环境,比如如下代码: window.onload=function(){ function sub ...

  5. Subclasses

    Given a collection of numbers, return all possible subclasses. public class Solution { public List&l ...

  6. LA 2031

    Mr. White, a fat man, now is crazy about a game named ``Dance, Dance, Revolution". But his danc ...

  7. SGU 104

    104. Little shop of flowers time limit per test: 0.25 sec. memory limit per test: 4096 KB PROBLEM Yo ...

  8. Eclipse 字体选择

    Windows下推荐使用Consolas Linux下推荐使用DejaVu Sans Mono, Website: http://dejavu-fonts.org/wiki/Main_PageDown ...

  9. Codeforces Round #262 (Div. 2) A B C

    题目链接 A. Vasya and Socks time limit per test:2 secondsmemory limit per test:256 megabytesinput:standa ...

  10. eclipse创建python项目

    http://jingyan.baidu.com/article/19192ad8173300e53f570757.html