코딩공부/프로그래머스
[Softeer/C++]Level1 나무심
usingsystem
2024. 3. 8. 00:22
728x90
https://softeer.ai/practice/7353
Softeer - 현대자동차그룹 SW인재확보플랫폼
softeer.ai
소스코드
#include<iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
int main(int argc, char** argv)
{
int n;
cin >> n;
vector<int> inputs;
int input, max = -100000;
for (int i = 0; i < n; i++)
{
cin >> input;
inputs.push_back(input);
}
int mul;
for (int i = 0; i < inputs.size(); i++)
{
for (int j = i + 1; j < inputs.size(); j++)
{
mul = inputs[i] * inputs[j];
if (max < mul)
{
max = inputs[i] * inputs[j];
}
}
}
cout << max;
return 0;
}
728x90