A Walk Through the Forest

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

Total Submission(s): 4843    Accepted Submission(s): 1759

Problem Description
Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office is on one side of a forest, and his house is on the other. A
nice walk through the forest, seeing the birds and chipmunks is quite enjoyable. 

The forest is beautiful, and Jimmy wants to take a different route everyday. He also wants to get home before dark, so he always takes a path to make progress towards his house. He considers taking a path from A to B to be progress if there exists a route from
B to his home that is shorter than any possible route from A. Calculate how many different routes through the forest Jimmy might take. 
 
Input
Input contains several test cases followed by a line containing 0. Jimmy has numbered each intersection or joining of paths starting with 1. His office is numbered 1, and his house is numbered 2. The first line of each test case gives the number of intersections
N, 1 < N ≤ 1000, and the number of paths M. The following M lines each contain a pair of intersections a b and an integer distance 1 ≤ d ≤ 1000000 indicating a path of length d between intersection a and a different intersection b. Jimmy may walk a path any
direction he chooses. There is at most one path between any pair of intersections. 
 
Output
For each test case, output a single integer indicating the number of different routes through the forest. You may assume that this number does not exceed 2147483647
 
Sample Input
5 6
1 3 2
1 4 2
3 4 3
1 5 12
4 2 34
5 2 24
7 8
1 3 1
1 4 1
3 7 1
7 4 1
7 5 1
6 7 1
5 2 1
6 2 1
0
 
Sample Output
2
4
 
Source
 
Recommend
Eddy   |   We have carefully selected several similar problems for you:  1217 1385 1162 1548 2544 
 

HUD-1142的更多相关文章

  1. mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table 'accounts' when using LOCK TABLES

    AutoMySQLBackup备份时,出现mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@' ...

  2. 如何用Unity GUI制作HUD

    若知其所以然,自然知其然. HUD是指平视显示器,就是套在脸上,和你的眼睛固定在一起,HUD的意思就是界面咯,一般我们说HUD特指把3D空间中的界面的某些信息(比如血条,伤害之类)的贴在界面上,对应3 ...

  3. xamarin UWP平台下 HUD 自定义弹窗

    在我的上一篇博客中我写了一个在xamarin的UWP平台下的自定义弹窗控件.在上篇文章中介绍了一种弹窗的写法,但在实际应用中发现了该方法的不足: 1.当弹窗出现后,我们拖动整个窗口大小的时候,弹窗的窗 ...

  4. xamarin UWP设置HUD加载功能

    使用xamarin开发的时候经常用到加载HUD功能,就是我们常见的一个加载中的动作,Android 下使用 AndHUD , iOS 下使用 BTProgressHUD, 这两个在在 NuGet 上都 ...

  5. BZOJ 1142: [POI2009]Tab

    1142: [POI2009]Tab Time Limit: 40 Sec  Memory Limit: 162 MBSubmit: 213  Solved: 80[Submit][Status][D ...

  6. ural 1142. Relations

    1142. Relations Time limit: 1.0 secondMemory limit: 64 MB Background Consider a specific set of comp ...

  7. OSG中的HUD

    OSG中的HUD 所谓HUD节点,说白了就是无论三维场景中的内容怎么改变,它都能在屏幕上固定位置显示的节点. 实现要点: 关闭光照,不受场景光照影响,所有内容以同一亮度显示 关闭深度测试 调整渲染顺序 ...

  8. CREATE A ENERGY / HEALTH BAR HUD

    Now then, let's get started. 1. Open the Play scene which you had created in the previous post. If y ...

  9. iOS之UI--指示器HUD的创建和设置

    指示器的创建和设置 渐变动画 描述: 使用label就能制作指示器,原理:就是让label以动画的形式慢慢显示和消失 最好是半透明的 指示器有时候也被称为:HUD,遮盖,蒙版 思路步骤: 1.先在st ...

  10. NGUI:HUD Text(头顶伤害漂浮文字)

    HUD Text 很早之前就有闻于NGUI中的HUD Text插件,今天得以尝试,看了会儿官方的文档,楞是没给看明白,官方的ReadMe.txt写的使用方法如下: 官网Usage 1. Attach ...

随机推荐

  1. 【BZOJ】【3282】Tree

    LCT 喜闻乐见的Link-Cut-Tree…… srO zyf http://www.cnblogs.com/zyfzyf/p/4149109.html 目测我是第222个?………………不要在意这些 ...

  2. xcodebuild和xcrun实现自动打包iOS应用程序

    随着苹果手持设备用户的不断增加,ios应用也增长迅速,同时随着iphone被越狱越来越多的app 的渠道也不断增多,为各个渠道打包成了一件费时费力的工作,本文提供一种比较智能的打包方式来减少其带来的各 ...

  3. java中byte和blob互转

    1. btye[]转blob byte[] bs = ... Blob blob = conn.createBlob(); blob.setBytes(1, bs); ps.setBlob(2, bl ...

  4. [百度空间] [原]跨平台编程注意事项(二): windows下 x86到x64的移植

    之前转的: 将程序移植到64位Windows 还有自己乱写的一篇: 跨平台编程注意事项(一) 之前对于x64平台的移植都是纸上谈兵,算是前期准备工作, 但起码在写代码时,已经非常注意了.所以现在移植起 ...

  5. ssh 远程 centos 乱码

    今天,帮我们同学处理一下中文显示乱码的问题.这个是个国内Linux用户烦恼的问题,由于大部分的Linux发行版都是以英语为主体的,而且英文在通用性和稳定性上都比中文要好一些,各种奇怪的BUG也要少一点 ...

  6. MySQL注入load_file常用路径

    WINDOWS下: c:/boot.ini //查看系统版本 c:/windows/php.ini //php配置信息 c:/windows/my.ini //MYSQL配置文件,记录管理员登陆过的M ...

  7. javascript利用拷贝的方法实现导出excel(可以导出表格线)

    Js代码: <script language=javascript> function preview() { window.clipboardData.setData("Tex ...

  8. UVA 11610 Reverse Prime (数论+树状数组+二分,难题)

    参考链接http://blog.csdn.net/acm_cxlove/article/details/8264290http://blog.csdn.net/w00w12l/article/deta ...

  9. Services学习(一)

    对于需要长期运行,例如播放音乐.长期和服务器的连接,即使已不是屏幕当前的activity仍需要运行的情况,采用服务方式.服务将通过API触发启动或者通过IPC(Interprocess Communi ...

  10. 使用Subversion进行版本控制

    使用Subversion进行版本控制 针对 Subversion 1.4(根据r2866编译) Ben Collins-Sussman Brian W. Fitzpatrick C. Michael  ...