Description Given a 2-dimensional array of positive and negative integers, find the sub-rectangle with the largest sum. The sum of a rectangle is the sum of all the elements in that rectangle. In this problem the sub-rectangle with the largest sum is
场景: main函数需要两个接口,一个求和函数,一个打印函数. int sum(int i, int j); 求两个int数字的和. void show(int i, char* name); 打印i的值和它的名称. 现在,需要制作: 一个静态库libcalc.a,提供sum的接口; 一个动态库libshow.so,提供show的接口. #include <stdio.h> #include "calc.h" #include "show.h" int
定义函数 //abstest.py def my_abs(x): if x >= 0: return x else: return -x 在该文件的当前目录下启动python解释器,用 from abstest import my_abs 来导入my_abs()函数. 定义可变参数: def calc(*numbers): sum = 0 for n in numbers: sum = sum + n*n return sum >>calc(1,2) 5 >>calc() 0
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> #include <map> #define N 1000005 using namespace std; int a[1005]; int calc(int s,int e,int &l,int &r) { int l1,l2,l3,r1,r2,r3; if(s==e) re