Some things do not see the hope to persist, but to insist on to see the hope Problem I: Stargate (a) time limit:1SEC Memory Limit: -MB Commit:8Solve:2[submission] [status] [discussion] Title description in 3000, the false Empire commanded N Galaxies, which were originally traveling near a beam ship, and recently Dr. X invented the Stargate, which uses wormhole technology, a wormhole that can connect any two galaxies, So that people do not have to wait to arrive at the destination immediately. The Imperial Emperor thought the invention was very strong, and decided to link the galaxies that he ruled with the Stargate. Can prove that the construction of N-1 wormholes can link these n galaxies together. Now, the question comes, and the emperor wants to know how many of these plans can put n galaxies in n-1 wormholes linked together? Enter the first line to enter an integer t that represents the number of groups of test data (T<= -There is only one row for each set of test data, and the row has only an integer n, which indicates that there are n galaxies. (2<=n<=1000000Output for each set of test data outputs an integer representing the number of scenarios that satisfy the test instructions. The output may be very large, please output the result of the construction plan number to 10003 after the remainder. Sample Input234Sample Output3 -indicates the number of spanning trees for n-Order complete graphs
The number of spanning trees of the N-order complete graph is n^n-2 specifically why ... And now it's not clear what to do after studying.
#include <stdio.h>#include<math.h>intMain () {intn,m,i,j; while(SCANF ("%d", &n)! =EOF) while(n--) {scanf ("%d",&m); for(j=1, i=0; i<m-2; i++) J= (j*m)%10003; printf ("%d\n", J); }return 0;} /************************************************************** problem:1109 User:baoan language:c Resul T: Correct time:0 MS memory:944 kb****************************************************************/
Number of fully generated graphs of N-order