现在的位置: 首页 > 综合 > 正文

UVA 11636 Hello World!

2014年01月26日 ⁄ 综合 ⁄ 共 277字 ⁄ 字号 评论关闭

//果然...连我这种渣渣都能AC的题,必定是水题

#include <stdio.h>
int iCount=0;
int f(int N,int init)
{
 if(N==init)
 {
  return iCount;
 }
 init*=2;
 iCount++;
 return N<=init?iCount:f(N,init);
}
int main()
{
 int init=1;
 int n=0;
 int N;
 while(1)
 {
  n++;
  scanf("%d",&N);
  if(N<=0)
  {
   break;
  }
  printf("Case %d: %d\n",n,f(N,init));
  iCount=0;
 }
 return 0;
}

抱歉!评论已关闭.