problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1614类 参考

洛谷 P1614 爱与愁的心痛 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1614 爱与愁的心痛

在文件 luogu.h437 行定义.

成员函数说明

◆ main()

int luogu::P1614::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp1433 行定义.

1433 {
1434 int n;
1435 int m;
1436 cin >> n >> m;
1437 auto *a = new int[n];
1438 for(int i = 0; i < n; i++) {
1439 cin >> a[i];
1440 }
1441 int ans = 100 * m;
1442 for(int i = 0; i + m <= n; i++) {
1443 int sum = 0;
1444 for(int j = i; j < i + m; j++) {
1445 sum += a[j];
1446 }
1447 ans = min(ans, sum);
1448 }
1449 cout << ans;
1450 delete[] a;
1451 return 0;
1452 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: