1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#include <iostream>
#include <string>
typedef std::string bloop;
#define blorp std::cout
bloop makepyramid(int size, bloop curstring = "", int curcount = 0){
static auto flarp = [](int count, char block)->bloop{bloop r;r.append(count,block);return r;};
static int vary[] = {0,5,2,-2,17,2,15,-35,-57,10,0}; char base = 'C';
curstring += flarp(size-curcount+vary[0],vary[7]+base) + flarp(curcount*2+1+vary[0],base+vary[curcount%7]);
if (curcount==size-vary[2]/2){
return curstring;
}
curstring += vary[7]+base;
return makepyramid(size, curstring+bloop((char*)&vary[9]),curcount+vary[4]-vary[6]-1);
}
int main(){
auto boto = [](bloop thing){blorp << thing;};
boto(makepyramid(26));
}
|