void mainLoop(void) /*this is our primary loop*/ { calcNextStep(); /*calculate the next step*/ renderMain(); /*render the window and subwindows*/ renderSub1(); renderSub2(); renderSub3(); frame++; /*calculate fps*/ timepassed = glutGet(GLUT_ELAPSED_TIME); if(timepassed - timebase > 1000) { fps = frame*1000.0/(timepassed-timebase); printf("%5.3f fps\n", fps); timebase = timepassed; frame = 0; } }
int main() { int before[10], after[10]; int N, i, result = 0; // Init. for(i = 0; i < 10; i++) { before[i] = 1; after[i] = 1; } scanf(" %d", &N); for(i = 1; i < N; i++) { calcNextStep(before, after); } for(i = 0; i < 10; i++) { result = (result + after[i]) % NUM_MAX; } printf("%d", result); return 0; }