Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
222876 | 2224梁翁思译 | *小美的加法 | C++ | 解答错误 | 40 | 8 MS | 292 KB | 483 | 2023-12-17 13:46:07 |
#include<bits/stdc++.h> using namespace std; int n = 0; long long sum = 0; int tmp = 0; long long temp = 0; int a = 0; long long summ = 0; int gb1=0,gb2=0; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for(int i = 0;i < n;i++) { cin >> tmp; temp += tmp; if(i) { if(tmp + a < tmp * a) { gb1 = tmp; gb2 = a; } } a = tmp; } cout << temp - gb1 - gb2 + gb1 * gb2<< endl; return 0; }