int main(int argc, char *argv[]) { int i = 45; for (i = 45; i <= 140; i++) { checkList[0] = i; triangleUp = upper(triangle(i)); search(lower(triangle(i))); if (found == 1) { /* 输出递归信息 */ printf("(3): %d -> %d\n", triangle(i), lower(triangle(i))); break; } checkList[0] = 0; } if (found == 1) /* 输出结果 */ printf("%d(%d)+%d(%d)+%d(%d)+%d(%d)+%d(%d)+%d(%d)=%d\n", triangle(checkList[0]),checkList[0], square(checkList[1]),checkList[1], pentagonal(checkList[2]),checkList[2], hexagonal(checkList[3]),checkList[3], heptagonal(checkList[4]),checkList[4], octagonal(checkList[5]), checkList[5], triangle(checkList[0])+square(checkList[1]) +pentagonal(checkList[2])+hexagonal(checkList[3]) +heptagonal(checkList[4])+octagonal(checkList[5]) ); return 0; }
String AudioChannelSet::getDescription() const { if (isDiscreteLayout()) return String ("Discrete #") + String (size()); if (*this == disabled()) return "Disabled"; if (*this == mono()) return "Mono"; if (*this == stereo()) return "Stereo"; if (*this == createLCR()) return "LCR"; if (*this == createLRS()) return "LRS"; if (*this == createLCRS()) return "LCRS"; if (*this == quadraphonic()) return "Quadraphonic"; if (*this == pentagonal()) return "Pentagonal"; if (*this == hexagonal()) return "Hexagonal"; if (*this == octagonal()) return "Octagonal"; if (*this == ambisonic()) return "Ambisonic"; if (*this == create5point0()) return "5.1 Surround"; if (*this == create5point1()) return "5.1 Surround (+Lfe)"; if (*this == create6point0()) return "6.1 Surround"; if (*this == create6point0Music()) return "6.1 (Music) Surround"; if (*this == create6point1()) return "6.1 Surround (+Lfe)"; if (*this == create7point0()) return "7.1 Surround (Rear)"; if (*this == create7point1()) return "7.1 Surround (Rear +Lfe)"; if (*this == create7point1AC3()) return "7.1 AC3 Surround (Rear + Lfe)"; if (*this == createFront7point0()) return "7.1 Surround (Front)"; if (*this == createFront7point1()) return "7.1 Surround (Front +Lfe)"; return "Unknown"; }
int main(int argc, const char *argv[]) { setlocale(LC_ALL, ""); int cur = 1533776805; /*int cur = 40755;*/ printf("\ntri: %i, hex: %i , pen: %i ", triangle(cur), hexagonal(cur), pentagonal(cur)); printf("\n"); /*cur = 1;*/ /*while (1){*/ /*cur = cur + 1;*/ /*if (triangle(cur) == 1 && pentagonal(cur) == 1 && hexagonal(cur) == 1){*/ /*break;*/ /*}*/ /*if(cur%1000 == 0)*/ /*printf("%'i \r", cur); */ /*}*/ /*printf("\nanswer: %i ", cur); */ /*printf("\ntri: %i, hex: %i , pen: %i ", triangle(cur), hexagonal(cur), pentagonal(cur)); */ return 0; }
int main(int argc, char *argv[]){ unsigned long ti=1, pi=1, hi=1; unsigned long tn, pn, hn; unsigned long found = 0; tn=triangular(ti); pn=pentagonal(pi); hn=hexagonal(hi); do{ while(pn < hn) pi++; if(pi > num_pn) { pi = num_pn; find_all_upto(pn[num_pn]*3); continue;} if(hn[hi] < pn[pi]) { hi++; printf("."); continue;} ti = pi; while(tn[ti] < pn[pi]) ti++; if(ti > num_tn) { ti = num_tn; find_all_upto(tn[num_tn]*3); continue;} if(pn[pi] < tn[ti]) { pi++; printf(","); continue;} if(pn[pi] == hn[hi] && hn[hi] == tn[ti]) { found++; hi++; printf("\n%lu %lu %lu %lu\n", tn[ti], ti, pi, hi); } } while(found<2) return 0; }
int main() { bool got_pentagonal = false, got_hexagonal = false; long tn , pn = 0, hn = 0, t = 285 + 1, p = 165, h = 143; while (!got_pentagonal && !got_hexagonal) { tn = triangle(t++); while (pn < tn) pn = pentagonal(p++); if (pn == tn) got_pentagonal = true; while (got_pentagonal && hn < pn) hn = hexagonal(h++); if (hn == pn) { got_hexagonal = true; } else { got_pentagonal = got_hexagonal = false; } } std::cout << tn << std::endl; return 0; }
bool cycfig(int stage, int minbound) { int testnum,testnum1; int testcase; switch(stage){ case 1: for(testnum=10;testnum<100;testnum++){ for(testnum1=testnum;testnum1<100;testnum1++){ if(triangle(testnum*100+testnum1)){ anscase[0]=3; casefound[3]=true; ans[0]=testnum; ans[1]=testnum1; if(cycfig(2,testnum)) return true; casefound[3]=false; } if(square(testnum*100+testnum1)){ anscase[0]=4; casefound[4]=true; ans[0]=testnum; ans[1]=testnum1; if(cycfig(2,testnum)) return true; casefound[4]=false; } if(pentagonal(testnum*100+testnum1)){ anscase[0]=5; casefound[5]=true; ans[0]=testnum; ans[1]=testnum1; if(cycfig(2,testnum)) return true; casefound[5]=false; } if(hexagonal(testnum*100+testnum1)){ anscase[0]=6; casefound[6]=true; ans[0]=testnum; ans[1]=testnum1; if(cycfig(2,testnum)) return true; casefound[6]=false; } if(heptagonal(testnum*100+testnum1)){ anscase[0]=7; casefound[7]=true; ans[0]=testnum; ans[1]=testnum1; if(cycfig(2,testnum)) return true; casefound[7]=false; } if(octagonal(testnum*100+testnum1)){ anscase[0]=8; casefound[8]=true; ans[0]=testnum; ans[1]=testnum1; if(cycfig(2,testnum)) return true; casefound[8]=false; } } } break; case 2: case 3: case 4: case 5: for(testnum=minbound;testnum<100;testnum++){ ans[stage]=testnum; for(testcase=3;testcase<9;testcase++){ if(casefound[testcase]==false){ switch(testcase){ case 3: if(triangle(ans[stage-1]*100+ans[stage])){ anscase[stage-1]=3; casefound[3]=true; if(cycfig(stage+1,minbound)) return true; casefound[3]=false; } break; case 4: if(square(ans[stage-1]*100+ans[stage])){ anscase[stage-1]=4; casefound[4]=true; if(cycfig(stage+1,minbound)) return true; casefound[4]=false; } break; case 5: if(pentagonal(ans[stage-1]*100+ans[stage])){ anscase[stage-1]=5; casefound[5]=true; if(cycfig(stage+1,minbound)) return true; casefound[5]=false; } break; case 6: if(hexagonal(ans[stage-1]*100+ans[stage])){ anscase[stage-1]=6; casefound[6]=true; if(cycfig(stage+1,minbound)) return true; casefound[6]=false; } break; case 7: if(heptagonal(ans[stage-1]*100+ans[stage])){ anscase[stage-1]=7; casefound[7]=true; if(cycfig(stage+1,minbound)) return true; casefound[7]=false; } break; case 8: if(octagonal(ans[stage-1]*100+ans[stage])){ anscase[stage-1]=8; casefound[8]=true; if(cycfig(stage+1,minbound)) return true; casefound[8]=false; } break; default: break; } } } } break; case 6: for(testcase=3;testcase<9;testcase++){ if(!casefound[testcase]){ anscase[5]=testcase; break; } } switch(testcase){ case 3: if(triangle(ans[5]*100+ans[0])) return true; break; case 4: if(square(ans[5]*100+ans[0])) return true; break; case 5: if(pentagonal(ans[5]*100+ans[0])) return true; break; case 6: if(hexagonal(ans[5]*100+ans[0])) return true; break; case 7: if(heptagonal(ans[5]*100+ans[0])) return true; break; case 8: if(octagonal(ans[5]*100+ans[0])) return true; break; default: break; } break; default: return false; } return false; }