알고리즘 풀이/백준

[백준 2576번]홀수

claire 2022. 1. 10. 22:26
#include<bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x;
	int min = 100;
	int sum = 0;
	for (int i = 0; i < 7; i++) {
		cin >> x;
		if (x % 2 != 0) {
			sum += x;
			if (x < min) {
				min = x;
			}
		}
	}
	if (sum == 0)cout << -1;
	else cout << sum << "\n" << min;
}