int main(int argc, const char *argv[]) { mpz_t largenum; int weight; clock_t ticks1, ticks2; if (argc < 3) { printf("Usage: %s <number> <weight>\n", argv[0]); return EXIT_FAILURE; } if (mpz_init_set_str(largenum, argv[1], 10) < 0) { perror("Invalid number"); return EXIT_FAILURE; } struct sched_param params; params.sched_priority = 2; fprintf(stderr, "setting scheduler %li\n", syscall(156, getpid(), 6, ¶ms)); weight = atoi(argv[2]); sleep(1); fprintf(stderr, "getting scheduler %li %ld\n", syscall(157, getpid()), syscall(378, getpid())); setweight(0, weight); ticks1 = clock(); find_factors(largenum); ticks2 = clock(); fprintf(stderr, "Time %ld\n", ticks2-ticks1); return EXIT_SUCCESS; }
void main()/*主函数*/ { int x,y; int i,j,k=0; for(i=0;i<N;i++) for(j=0;j<N;j++) board[i][j]=0; setweight(); setmap(); while(1) { printf("输入马的行坐标 X (from 0 to 7):"); scanf("%d",&x); printf("输入马的列坐标 Y (from 0 to 7):"); scanf("\n%d",&y); if(x<0||x>7||y<0||y>7) {printf("输入错误!\n\n"); flushall();} else break; } Path(x,y); }/*end main()*/
int main() { struct around start; s.top = 0; printf("input: (0-7)\nX:"); scanf("%d",&start.x); printf("Y:"); scanf("%d",&start.y); setweight(); setmap(); HorsePath(start); OutputPath(); //ShanShuo(); return 0; }
/* ====================================================================== */ void addarete(graphe * g, uint32_t som, uint32_t a, double weight) /* ====================================================================== */ { uint32_t i; i = g->ind; ajoutearete2(g, som, a,i); /* indexarete(g, som, a, i); */ ajoutearete2(g, a, som,i); /* indexarete(g, a, som, i); */ g->tete[i] = a; g->queue[i] = som; setweight(g, i, weight); g->ind= i+1; } /* addarete() */