fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long long int cost = 0;
  6. for(int i=1;i<53;i++) {
  7. cout<<"cost of creating tile "<<(1LL<<(i+1))<<" is "<<cost<<endl;
  8. cost = 2*cost+1;
  9. }
  10. return 0;
  11. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
cost of creating tile 4 is 0
cost of creating tile 8 is 1
cost of creating tile 16 is 3
cost of creating tile 32 is 7
cost of creating tile 64 is 15
cost of creating tile 128 is 31
cost of creating tile 256 is 63
cost of creating tile 512 is 127
cost of creating tile 1024 is 255
cost of creating tile 2048 is 511
cost of creating tile 4096 is 1023
cost of creating tile 8192 is 2047
cost of creating tile 16384 is 4095
cost of creating tile 32768 is 8191
cost of creating tile 65536 is 16383
cost of creating tile 131072 is 32767
cost of creating tile 262144 is 65535
cost of creating tile 524288 is 131071
cost of creating tile 1048576 is 262143
cost of creating tile 2097152 is 524287
cost of creating tile 4194304 is 1048575
cost of creating tile 8388608 is 2097151
cost of creating tile 16777216 is 4194303
cost of creating tile 33554432 is 8388607
cost of creating tile 67108864 is 16777215
cost of creating tile 134217728 is 33554431
cost of creating tile 268435456 is 67108863
cost of creating tile 536870912 is 134217727
cost of creating tile 1073741824 is 268435455
cost of creating tile 2147483648 is 536870911
cost of creating tile 4294967296 is 1073741823
cost of creating tile 8589934592 is 2147483647
cost of creating tile 17179869184 is 4294967295
cost of creating tile 34359738368 is 8589934591
cost of creating tile 68719476736 is 17179869183
cost of creating tile 137438953472 is 34359738367
cost of creating tile 274877906944 is 68719476735
cost of creating tile 549755813888 is 137438953471
cost of creating tile 1099511627776 is 274877906943
cost of creating tile 2199023255552 is 549755813887
cost of creating tile 4398046511104 is 1099511627775
cost of creating tile 8796093022208 is 2199023255551
cost of creating tile 17592186044416 is 4398046511103
cost of creating tile 35184372088832 is 8796093022207
cost of creating tile 70368744177664 is 17592186044415
cost of creating tile 140737488355328 is 35184372088831
cost of creating tile 281474976710656 is 70368744177663
cost of creating tile 562949953421312 is 140737488355327
cost of creating tile 1125899906842624 is 281474976710655
cost of creating tile 2251799813685248 is 562949953421311
cost of creating tile 4503599627370496 is 1125899906842623
cost of creating tile 9007199254740992 is 2251799813685247