Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
40349 | chenyifei | 不与最大数相同的数字之和 | C++ | Accepted | 0 MS | 240 KB | 340 | 2024-02-09 18:10:02 |
#include<iostream> using namespace std; int main() { int a[110],sum=0,max=0; int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]>max) { max=a[i]; } } for(int j=1;j<=n;j++) { if(max!=j) { sum+=j; } } cout<<sum; return 0; }