7/31/2013

11636 - Hello World! - UVA

  1. #include<iostream>
  2. using namespace std;
  3. int main ()
  4. {
  5.         int pastes  , N , lines;
  6.         int i = 0;
  7.         while(cin>>N)
  8.         {
  9.                 i++;
  10.                 lines = 1;
  11.                 pastes = 0;
  12.                 if(N<0)
  13.                         break;
  14.                 else if(== 1)
  15.                 {
  16.                         pastes = 0;
  17.                 }
  18.                 else
  19.                 {
  20.                         while(true)
  21.                         {
  22.                                 lines *=2;
  23.                                 if(lines >= N)
  24.                                 {
  25.                                         pastes++;
  26.                                         break;
  27.                                 }
  28.                                 else
  29.                                         pastes++;
  30.                         }
  31.                 }
  32.                 cout<<"Case "<<i<<": "<<pastes<<endl;
  33.         }
  34.         return 0;
  35. }


    You can find more of my solutions on Here

No comments:

Post a Comment