{"trustable":false,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"Describe","value":{"format":"HTML","content":"我想追小姐姐了!\u003cbr\u003e\n但是小姐姐有很多追求者,我该怎么办才能最快的到达小姐姐所在的地点?\u003cbr\u003e\n我在地点1,小姐姐在地点N。"}},{"title":"Input","value":{"format":"HTML","content":"输入包括多组数据。每组数据第一行是两个整数N、M(N\u0026lt;\u003d100,M\u0026lt;\u003d10000),N表示有几个路口,M则表示有几条路。N\u003dM\u003d0表示输入结束。接下来M行,每行包括3个整数A,B,C(1\u0026lt;\u003dA,B\u0026lt;\u003dN,1\u0026lt;\u003dC\u0026lt;\u003d1000),表示在地点A与地点B之间有一条路,我需要C分钟的时间走过这条路。 \n\u003cbr\u003e输入保证至少存在1条我找到小姐姐的路线。\n\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"对于每组输入,输出一行,表示我走到小姐姐所在位置的最短时间"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2 2\n1 2 12\n1 2 3\n3 4\n1 2 6\n1 2 5\n2 3 5\n3 1 2\n0 0\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e3\n2\u003c/pre\u003e"}}]}