|
||||||||||
matrixTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1121 Accepted Submission(s): 631 Problem Description Given a matrix with $n$ rows and $m$ columns ( $n+m$ is an odd number ), at first , you begin with the number at top-left corner (1,1) and you want to go to the number at bottom-right corner (n,m). And you must go right or go down every steps. Let the numbers you go through become an array $a_1, a_2, ... , a_{2k}$. The cost is $a_1*a_2+a_3*a_4+...+a_{2k-1}*a_{2k}$. What is the minimum of the cost? Input Several test cases(about $5$) For each cases, first come 2 integers, $n,m(1 \leq n \leq 1000,1 \leq m \leq 1000)$ N+m is an odd number. Then follows $n$ lines with $m$ numbers $a_i,j ( 1 \leq a_i \leq 100)$ Output For each cases, please output an integer in a line as the answer. Sample Input
Sample Output
Source | ||||||||||
|