Submission #3770793
Source Code Expand
#include<bits/stdc++.h> #define hh(i,s,t) for(int i=s;i<=t;++i) using namespace std; int n,a[2333]; int main(){ cin>>n; int maxx=0,sum=0; hh(i,1,n){ cin>>a+i; maxx=max(maxx,a[i]); sum+=a[i]; } cout<<sum<<endl; sum-=maxx; if(sum>maxx) cout<<"0"<<endl; else cout<<maxx-sum<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - 2点間距離の最大と最小 ( Maximum and Minimum ) |
User | luogu_bot1 |
Language | C++ (GCC 5.4.1) |
Score | 0 |
Code Size | 366 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:9:12: error: no match for ‘operator>>’ (operand types are ‘std::istream {aka std::basic_istream<char>}’ and ‘int*’) cin>>a+i; ^ In file included from /usr/include/c++/5/sstream:38:0, from /usr/include/c++/5/complex:45, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:66, from ./Main.cpp:1: /usr/include/c++/5/istream:168:7: note: candidate: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(bool& __n) ^ /usr/include/c++/5/istream:168:7: note: conversion of argument 1 would be ill-formed: ./Main.cpp:9:15: error: invalid initialization of non-const reference of type ‘bool&’ from an rvalue of type ‘bool’ cin>>a+i; ^ In file included fr...