CS/Algorithm 문제
[BaekJoon] 백준 2562번 최댓값
심심231
2020. 3. 27. 01:57
[BaekJoon] 백준 2562번 최댓값
문제: https://www.acmicpc.net/problem/2562
내코드
- 간단한 문제
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(0);
int num[9];
int max = 0;
for (int i = 0; i < 9; i++) {
cin >> num[i];
max = max < num[i] ? num[i] : max;
}
cout << max << "\n";
for (int i = 0; i < 9; i++) {
if (max == num[i]) cout << i + 1 << "\n";
}
return 0;
}
참고
728x90
반응형