QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#65414#5122. Strange SumressoaWA 2ms3320kbC++17477b2022-11-30 15:37:572022-11-30 15:38:00

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-30 15:38:00]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3320kb
  • [2022-11-30 15:37:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
    int n;
    cin>>n;
    ll a[n+1];
    for(int i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
    ll ans=0;
    for(int i=n-1;i>=max(0,n-2);i--){
        ans+=max(0ll,a[i]);
    }
    cout<<ans<<'\n';
    return void();
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t=1;
//    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3320kb

input:

4
1 4 3 2

output:

5

result:

wrong answer 1st numbers differ - expected: '7', found: '5'