8587: Fraction Game

内存限制:512 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

NIO is playing a novel fraction game. The interface is shaped like an isosceles triangle of size n. In each grid there is a fractional number. Every round, an isosceles upward triangle area of size k is activated to click. And when the round is finished and a new round begins, a new area of a triangle is able to click, and the old area is locked, except the overlap region. For each triangle, NIO can click on a grid, and the fractional number inside this grid will be added to his score. If NIO clicks on a grid slowly, then he will get no score to add. If all possible upward triangles with size k on the interface can be clicked during the game time. What is the maximum score NIO will get ideally? Size nnn means that in the i-th line there are i triangles.

输入格式

For each test case, the first line contains two numbers, n denotes the height of the game interface and k (1≤kn≤1000) denotes the size of the upward triangle that each round NIO can operate.
Following by n lines, each line contains i numbers. Each fractional number aij is in the form of a/b (1≤a,b≤1000), represents the j-th number in the i-th line.

输出格式

Output the reduction of a fraction, representing the maximum score NIO will get. For example, "4/12" can be reduced to "1/3".

输入样例 复制

3 3
1/3
5/28 11/37
14/31 17/29 7/47

输出样例 复制

17/29

数据范围与提示

The test data is guaranteed not to exceed long long during the operation. If the result is "3/1", output "3/1" directly.