Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
222868 | 232214陈皓轩 | *小美的加法 | C++ | Accepted | 100 | 40 MS | 1832 KB | 460 | 2023-12-17 13:35:44 |
#include <iostream> using namespace std; int n; long long cnt[100005], a[100005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { int t;//没个卵用 cin >> t; cnt[i] = t + cnt[i - 1], a[i] = t; //cout << cnt[i] << '\n'; } long long ans(cnt[n]); for (int i = 1; i < n; i++) { ans = max(ans, cnt[n] - a[i] - a[i + 1] + a[i] * a[i + 1]); //cout << cnt[n] - a[i] - a[i + 1] + a[i] * a[i + 1] << '\n'; } cout << ans; }