[Exam Problems] C# Advanced - Judge problem{17} - Biggest Table Row
You are given an HTML table with 4 columns: Town, Store1, Store2 and Store3. It consists of sequence of text lines: the "<table>" tag, the header row, several data rows, and "</table>" tag (see the examples below). The Store1, Store2, and Store3 columns hold either numbers or "-" (which means "no data"). Your task is to write a program which parses the table data rows and finds the row with a maximal sum of its values.
while (true)
{
string input = Console.ReadLine();
if (input == "</table>")
{
break;
}
Регекса ми е : (-?[0-9\.]+)
Хваща си всичките интове дабъли и т.н. но въпроса ми е как да си обходя линия по линия зада си сумирам съвпаденията.Пример:
<table>
<tr><th>Town</th><th>Store1</th><th>Store2</th><th>Store3</th></tr>
<tr><td>Sofia</td><td>26.2</td><td>8.20</td><td>-</td></tr>
<tr><td>Varna</td><td>11.2</td><td>18.00</td><td>36.10</td></tr>
<tr><td>Plovdiv</td><td>17.2</td><td>12.3</td><td>6.4</td></tr>
<tr><td>Bourgas</td><td>-</td><td>24.3</td><td>-</td></tr>
</table>
11.2+18.00+36.10
Иначе, аз използвам този регекс: (\+|-)?(?=\d*[.eE])([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?|(\+|-)?\b\d+\b. Тази част( (\+|-)?(?=\d*[.eE])([0-9]+\.?[0-9]*|\.[0-9]+)([eE](\+|-)?[0-9]+)?) я намерих в интернет, а другата я добавих за цели числа.