OpenJudge - 17:The Largest City Nearby
17:The Largest City Nearby
总时间限制:
1000ms
内存限制:
65536kB
描述
There are N cities, the length of edges between cities is given. Please find the city with the largest index id satisfying that there exisits a path between city 1 and city id and the length of this path is no more than K.
有N个城市,给出每个城市的边缘的长度。找出带有最大下标id的城市,满足在城市1和城市id之间存在一个长度不超过K的路径。
输入
First line: two positive integers N (N <= 100) and K (K <= 10000).
第一行:两个正整数N(N<=100)和K(K<=10000)。
Next N lines: the i-th line contains N non-negative integers (<= 100) indicating the length of edge between city i and other cities.
下N行:第i行包含N个非负整数(<=100)表示城市i和其他城市之间的路径的长度。
输出
One integer id.
一个整数id。
样例输入
4 6 0 4 5 7 4 0 9 3 5 9 0 1 7 3 1 0
样例输出
4