21787_KingofDestruction

2022-5-16 18:20| 发布者: Hocassian| 查看: 25| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505848028600-Problem List-采集的数据-后羿采集器.html

Pro.ID

21787

Title

King of Destruction

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21787

AC

10

Submit

23

Ratio

43.48%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Zhou xingxing is the successor of one style of kung fu called "Karate Kid". he is falling love with a beautiful judo student, after being humiliated by her boyfriend, a Taekwando master from Japan, Zhou is going to fight with his rival in love. The way they fight is to destroy the wooden plank between some wooden pegs, in order to cut these wooden pegs into two disconnected parts, and destroy each piece of plank need consume different energy. However Zhou xingxing is beginner after all, so he is turn to you for help, please calculate the minimum energy he need to destroy the wooden plank.

    输入

    The input consists of multiple test cases.

    Each test case starts with two integers n ( 0 < n ≤ 100 ) and m in one line, where n, m are the number of wooden pegs and wooden plank.

    Following are m lines, each line contains three integers s, e and q ( 0 ≤ s, e < n,  q > 0 ), meaning that there need q energy to destroy the wooden plank between s and e.

    输出

    Description

    Zhou xingxing is the successor of one style of kung fu called "Karate Kid". he is falling love with a beautiful judo student, after being humiliated by her boyfriend, a Taekwando master from Japan, Zhou is going to fight with his rival in love. The way they fight is to destroy the wooden plank between some wooden pegs, in order to cut these wooden pegs into two disconnected parts, and destroy each piece of plank need consume different energy. However Zhou xingxing is beginner after all, so he is turn to you for help, please calculate the minimum energy he need to destroy the wooden plank.

    Input

    The input consists of multiple test cases.

    Each test case starts with two integers n ( 0 < n ≤ 100 ) and m in one line, where n, m are the number of wooden pegs and wooden plank.

    Following are m lines, each line contains three integers s, e and q ( 0 ≤ s, e < n,  q > 0 ), meaning that there need q energy to destroy the wooden plank between s and e.

    Output

    There is only one line for each test case, which contains the minimum energy they need to complete this fight.

    Sample Input

    2 1
    0 1 50
    3 2
    0 1 50
    1 2 10

    Sample Output

    50
    10

    Source

    样例输入

    2 1
    0 1 50
    3 2
    0 1 50
    1 2 10

    样例输出

    50
    10

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部