Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
2095 A班-岑思熠 象棋比赛 C++ 解答错误 0 0 MS 260 KB 340 2024-12-14 10:48:12

Tests(0/3):


#include<bits/stdc++.h> using namespace std; int main() { int n,sum=0,temp=0,i; cin>>n; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=0;i<n;i++) { if(a[i]>a[i-1]) { sum+=a[i]; } else { temp+=a[i-1]; } } if(sum>temp) { cout<<a[i]; } else { cout<<a[i-1]; } }


测评信息: