国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

算法競賽AcWing在線題庫_4395. 最大子矩陣

2022-04-19 10:10 作者:Clayton_Zhou  | 我要投稿


#include<iostream>??

#include<algorithm>

?using namespace std;


?/*?

?(a[i]+ a[i+1]+...+a[j])(b[s]+ b[s+1]+...+b[t])<=x

?求 (j - i + 1)*(t - s + 1) 最大

?*/

const int N = 2010;

int n=3, m=3, x=9;

int a[N]={0,1,2,3};

int b[N]={0,1,2,3};

int c[N * N];


int main() {

?/*

cin >> n >> m;

? ? for (int i = 1; i <= n; i++) cin >> a[i], a[i] += a[i - 1];

? ? for (int i = 1; i <= m; i++) cin >> b[i], b[i] += b[i - 1];

? ? cin >> x;?

*/

??

for (int i = 1; i <= n; i++)? ? a[i] += a[i - 1];

? ? for (int i = 1; i <= m; i++)? ?b[i] += b[i - 1];


? ? // 數(shù)組c[tar],表示和不超過tar子區(qū)間的最大長度

? ? for (int i = 1; i <= m; i++)

? ? ? ? for (int j = i; j <= m; j++)? ? ? ? ? ?

{ if (c[b[j] - b[i - 1]]<j - i + 1)c[b[j] - b[i - 1]]=j - i + 1;

cout<<b[j] - b[i - 1]<<"? "<<j - i + 1<<endl;

}

? ? for (int i = 1; i < N * m; i++) if (c[i]< c[i - 1])c[i]= c[i - 1];

? ? ? ??

cout << endl;

for (int i = 1; i <n * m; i++) cout<<c[i]<<"? "<<i<<endl;

cout << endl;

? ? int res = 0;

? ? for (int i = 1; i <= n; i++)

? ? ? ? for (int j = i; j <= n; j++) {

? ? ? ? ? ? int tar = x / (a[j] - a[i - 1]);?

cout<<tar<<"? "<<j - i + 1<<endl;

if (tar >= N * m) { if(res<(j - i + 1) * m)res= (j - i + 1) * m; }

? ? ? ? ? ? else?

if(res< c[tar] * (j - i + 1))res= c[tar] * (j - i + 1);

? ? ? ? }

? ? cout << res<<endl;

}


算法競賽AcWing在線題庫_4395. 最大子矩陣的評論 (共 條)

分享到微博請遵守國家法律
大宁县| 龙胜| 滦平县| 彭水| 江门市| 承德市| 根河市| 永新县| 友谊县| 自贡市| 香格里拉县| 公安县| 尼玛县| 榆中县| 大新县| 朔州市| 建水县| 宣武区| 齐河县| 丹巴县| 平乐县| 海原县| 崇文区| 临沂市| 辉县市| 阳西县| 安顺市| 拉萨市| 防城港市| 信丰县| 启东市| 靖安县| 博白县| 福建省| 南丹县| 阳谷县| 囊谦县| 吴江市| 张家港市| 贵定县| 彩票|