Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 6th, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     long long int simple = 1, mega = 0, giga = 0;
  7.     long long limit = 1000000000;
  8.  
  9.     for (int i=0; i<64; i++)
  10.     {
  11.         if (mega == 0 && giga == 0)
  12.         {
  13.             cout << i << " = " << simple << endl;
  14.         }
  15.         if (mega != 0 && giga == 0)
  16.         {
  17.             cout << i << " = " << mega << simple << endl;
  18.         }
  19.         if (mega != 0 && giga != 0)
  20.         {
  21.             cout << i << " = " << giga << mega << simple << endl;
  22.         }
  23.  
  24.         mega *= 2;
  25.         simple *= 2;
  26.         giga *= 2;
  27.  
  28.         if (simple > limit)
  29.         {
  30.             simple -= limit;
  31.             mega++;
  32.         }
  33.         if (mega > limit)
  34.         {
  35.             mega -= limit;
  36.             giga++;
  37.         }
  38.     }
  39.  
  40.     return 0;
  41. }