답안 #851235

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851235 2023-09-19T05:28:16 Z dosts Autići (COCI22_autici) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define sp << " " << 
#define int long long
#define vi vector<int>
#define pb push_back
const int N = 1e5+1;


void solve() {
	int n;
	cin >> n;
	vi a(n+1);
	for (int i=1;i<=n;i++) cin >> a[i];
	int sm =0;
	for (int i=1;i<=n;i++) sm+=a[i];
	int mn = *min_element(a.begin()+1,a.end());
	cout << (n-1)*mn+sm-mn << endl;5
}    




                                
signed main() { 
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t; 
    while (t --> 0) solve();
}



Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:18:34: error: expected ';' before '}' token
   18 |  cout << (n-1)*mn+sm-mn << endl;5
      |                                  ^
      |                                  ;
   19 | }
      | ~                                 
Main.cpp:18:33: warning: statement has no effect [-Wunused-value]
   18 |  cout << (n-1)*mn+sm-mn << endl;5
      |                                 ^