int main (int argc, char ** argv) { printf ("LINEENDINGS TESTS\n"); printf ("==================\n\n"); init (argc, argv); testvalid ("lineendings/valid1"); testinconsistent ("lineendings/inconsistent"); testinvalid ("lineendings/invalid"); printf ("\ntestmod_lineendings RESULTS: %d test(s) done. %d error(s).\n", nbTest, nbError); return nbError; }
int main(){ clock_t begin,end; double time_spent; begin = clock(); unsigned int a,b,c; while(p<=1000){ a=(p>>3)+5; //a is shortest leg b=(p>>2)-1; // b is other leg c=(p>>2); // c is hypotenuse for(a=(p>>3); a<(p/3); a++){ for(b=((p>>2)-1); b<c; b++){ for(c=(p>>2); c<(p>>1);c++){ //printf("(%d,%d,%d)\n",a,b,c); if((c>a)&&(c>b)&&(a<b)&&(b<c)){ if(!testvalid(a,b,c)){ score++; c++; //no duplicates } } } } } if(score>highscore){ highscore=score; //printf("score for p=%d => %d \n", p,highscore); } if(p>420) p+=8; //even faster! else p+=4; //really important optimization! score=0; } end = clock(); time_spent = (double)(end - begin) / CLOCKS_PER_SEC; printf("score: %d\n",highscore); printf("%f\n",time_spent); return 0; }