Archive for 九月, 2014



struct test {
    int num;

void change_value(struct test *out)
    struct test *in = (struct test *)malloc(sizeof(struct test));
    in->num = 100;
    out = in;
    printf("in num:%d\n",out->num);

int main()
    struct test *out = (struct test *)malloc(sizeof(struct test));
    out->num = 0;


    printf("out num:%d\n",out->num);
    return 0;

Read More →

Empire Problem


The empire has a capitol and a number of cities. Some cities are connected to other cities. A route connecting two cities can transport a message in both directions. All cities are reachable using some path from the capitol city. The connections among all cities are described in an adjacency matrix with the format shown below. At the start, a message is sent from the capitol city to all other cities, and we want to know what’s the minimal time for a message to spread out from the capitol to the whole empire.
Read More →