λ°μν
https://www.acmicpc.net/problem/2587
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int sum=0;
vector<int>input (5);
for(int i=0; i<5; i++) {
cin >> input[i];
sum += input[i];
}
sort(input.begin(), input.end());
cout << sum/5 << "\n" << input[2];
return 0;
}
μμ½λ©
#include <bits/stdc++.h>
using namespace std;int main(){int s=0;int n[5];for(int i=0;i<5;i++){cin>>n[i];s+=n[i];}sort(n,n+5);cout<<s/5<<"\n"<<n[2];}
λ°μν
'π Baaaaaarking > 0x02κ° - κΈ°μ΄ μ½λ μμ± μλ Ή II' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[BOJ][C++] λ°±μ€ 2440λ²: λ³ μ°κΈ° - 3 (0) | 2023.05.18 |
---|---|
[BOJ][C++] λ°±μ€ 1267λ²: νΈλν° μκΈ (0) | 2023.05.17 |
[BOJ][C++] λ°±μ€ 2576λ²: νμ (0) | 2023.05.11 |
[BOJ][C++] λ°±μ€ 2490λ²: μ·λμ΄ (0) | 2023.05.10 |
[λ°±μ€/BOJ][CμΈμ΄] 2480λ²: μ£Όμ¬μ μΈκ° (0) | 2021.05.20 |