int main(){ long long int d_min = 100000000; long long int l_min = 100000000; long long int r_min = 100000000; long long int sa; long long int wa; for (long long int i = 1; i < 10000000000; i++) { sa = 3*i + 1; wa = (sa + 1) * i + 1; if (is_penta(sa) && is_penta(wa)) { d_min = min(d_min, sa); l_min = penta(i); r_min = penta(i+1); } } printf("d_min: %lld\n", d_min); printf("l_min: %lld\n", l_min); printf("r_min: %lld\n", r_min); return 0; }
int sumsub_pental (n) { long i = n-1; long pentn = penta(n); long penti = penta (i); int tmp = (is_pental (pentn+penti) && is_pental (pentn - penti)); while ((!tmp) && (i > 0)) { i--; penti = penta(i); tmp = (is_pental (pentn+penti) && is_pental (pentn - penti)); } if (tmp) { return pentn-penti; } else { return 0; } }
int main(){ int t = 285; int p = 165; int h = 143; t++; int tt = tri(t); int pp = penta(p); int hh = hexa(h); while (1) { if (tt == pp && tt == hh) { break; } while (tt < pp && tt < hh) { t++; tt = tri(t); } while (pp < tt && pp < hh) { p++; pp = penta(p); } while (hh < tt && hh < pp) { h++; hh = hexa(h); } } printf("tt: %d\n", tt); return 0; }
int main(){ initCanvas("Pentagon and Star"); double pentaV[5][2], starV[5][2]; for(int i=0; i<5; i++){ pentaV[i][0] = 100 * cos(2*PI/5*i); pentaV[i][1] = 100 * sin(2*PI/5*i); starV[i][0] = 100 * cos(4*PI/5*i); starV[i][1] = 100 * sin(4*PI/5*i); } Polygon penta(200,200,pentaV,5); Polygon star(200,400,starV,5); for(int i=0; i<100; i++){ penta.left(5); star.right(5); wait(0.1); } getClick(); }
void main() { inicializa(); stars(); eme(100, 150, 200, 250, 300, 100, 200, 250, 300, 5, LIGHTGRAY); getch(); clearviewport(); cruz(100,150,200,250,300,100,150,200,250,300,5, WHITE); stars(); getch(); clearviewport(); stars(); cinco(250,300,350,100,150,200,250,300,350,8, RED); getch(); clearviewport(); stars(); penta(200,300,400,350,250,120,200,300,9,BLUE); getch(); clearviewport(); stars(); batman(100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 330, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520, 540, 560, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 2, YELLOW); getch(); }