정신과 시간의 방
카테고리
작성일
2024. 5. 12. 22:42
작성자
risehyun
  • 문제

 

  • 풀이
#include <iostream>

using namespace std;
int main()
{
	int maxValue = -1;
	int maxIndex = -1;
	int input = 0;

	for (int i = 1; i <= 9; i++)
	{
		cin >> input;

		if (input > maxValue)
		{
			maxValue = input;
			maxIndex = i;
		}
	}

	cout << maxValue << '\n';
	cout << maxIndex;

}

'코딩테스트' 카테고리의 다른 글

★ [백준/10250번/C++] ACM 호텔  (0) 2024.05.14
[백준/2884번/C++] 알람시계  (0) 2024.05.13
[백준/31403번/C++] A + B - C  (0) 2024.05.11
[백준/11720번/C++] 숫자의 합  (0) 2024.05.10
[백준/2439번/C++] 별 찍기 - 2  (0) 2024.05.09