Author: lethic

51-MCU Project: Canteen order device

February 9, 2013 MCU, Tech No comments

This is the first project I made using 51 series MCU, together with my two friends Pengfei Gao & Kang zhao.
We had fun

The clerk in our shool’s c[……]

Read more

draw Taylor Swift 2

February 5, 2013 Sketch Book No comments

I borrowed an IPAD from Zengshen and the Sketchbook app performs better on it than that on my Android cell phone.

It is mainly because the IPAD has[……]

Read more

draw Taylor Swift 1

February 5, 2013 Sketch Book No comments

This is the first time that I use SketchBook, which is a software released by Autodesk.

It has Android Version and IOS Version.

And it works pe[……]

Read more

LAMP installation in Ubuntu 12.04

February 3, 2013 Linux No comments

LAMP means Linux + Apache + Mysql + PHP, which enables me to manage my website.

The installed software environment will be used in the Apache2 Web[……]

Read more

20th Birthday: Dream On

December 8, 2012 Essay 1 comment

Even though a truck loads of dreams has not been realiazed yet
it’s still never too late if you get started right now.
20

***********************[……]

Read more

SPFA:Til the Cows Come Home

October 27, 2012 Graph Theory No comments

D – Til the Cows Come Home
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
SubmitStatus

Description
Bessie is out in[……]

Read more

BellmanFord: Til the cows come home

October 27, 2012 Graph Theory No comments

Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 20995 Accepted: 6994

Description
Bessie is out in the field and wants to get b[……]

Read more

Kruskal: Matrix

October 27, 2012 Graph Theory No comments

Problem Description
Machines have once again attacked the kingdom of Xions. The kingdom of Xions has N cities and N-1 bidirectional roads. The road n[……]

Read more

SPFA: Power Transmission

October 27, 2012 Graph Theory No comments

Problem Description

The project West-East power transmission is famous around the world. It transmits the electricity from western areas to east Ch[……]

Read more

Dijkstra: Till the Cows Come Home

October 27, 2012 Graph Theory No comments

D – Til the Cows Come Home
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
SubmitStatus

Description
Bessie is out in[……]

Read more

Kruscal: Agri-Net

October 27, 2012 Graph Theory No comments

B – Agri-Net
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
SubmitStatus

Description
Farmer John has been elected ma[……]

Read more

Prim: Agri-Net

October 27, 2012 Graph Theory No comments

B – Agri-Net
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
SubmitStatus

Description
Farmer John has been elected ma[……]

Read more

October 3, 2012 Graph Theory No comments

eg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#define MAX 10000
 
using namespace std;
 
int cnt;//0
int lastshow[MAX];//i,-1
int sum;
int vis[MAX];
 
struct edge{   //a->b
    int to;    //b
    int pro;  //a
    int weight;//
}e[MAX];
 
void insert(){
    int a, b, weight;
    scanf("%d %d %d", &a, &b, &weight);
    e[cnt].to = b;
    e[cnt].pro = lastshow[a]; //a
    e[cnt].weight = weight;
    lastshow[a] = cnt ++; //lastshow
}
 
int dfs(int a){
    if(vis[a])
        return 0;
//    cout << endl << a << endl;
    vis[a] = 1;
    int ret = 0;
    int id = lastshow[a];
    while(id != -1){
        ret += e[id].weight;
//        cout << endl << e[id].weight << endl;
        ret += dfs(e[id].to);
        id = e[id].pro;
    }
    return ret;
}
 
int main(){
    int n, c, srch;
    int i, j, k;
    while(cin >> n >> c){
        cnt = 0;
        sum = 0;
        memset(vis, 0, sizeof(vis));
        for(i = 0; i < MAX; i ++){
            lastshow[i] = -1;
        }
        for(i = 0; i < c; i ++){
            insert();
        }
        //i
        while(~scanf("%d", &srch)){
            if(-1 == srch)
                break;
            int id = lastshow[srch];
            cout << "" << srch << ":"<<endl;
            while(id != -1){
                cout << e[id].to << " " << e[id].weight << endl;
                id = e[id].pro;
            }
        }
        cout << "" << dfs(0) << endl;
    }
    return 0;
}

Color A Tree

October 3, 2012 Graph Theory No comments

Description
Bob is very interested in the data structure of a tree. A tree is a directed graph in which a special node is singled out, called the “ro[……]

Read more

+Toy Storage

October 3, 2012 Computational Geometry No comments

Description
Mom and dad have a problem: their child, Reza, never puts his toys away when he is finished playing with them. They gave Reza a rectangul[……]

Read more

: Intersection

October 3, 2012 Computational Geometry No comments

IntersectionTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
SubmitStatus

Description
You are to write a program that h[……]

Read more

2012 CUMCM

September 12, 2012 Mathematical Modeling No comments

This C++ program is to solve the B problem during the 2012 CUMCM. The goal is to make the most use of the outside floor of a house to place the solar[……]

Read more

My Preliminary Plan On Mathematical Modeling

August 24, 2012 Mathematical Modeling No comments

There will be a competition in the autumn, so it’s time to make some preparation.

First of all, the use of Matlab and Lingo is necessary. Since I’m[……]

Read more

Let’s Start From Here

August 22, 2012 Essay No comments

Today is the debut for my new blog: http://www.zlethic.com. And Im so happy about that. Ive always been dreaming to have my own website. This woul[……]

Read more