https://www.acmicpc.net/problem/2562
using System;
using System.IO;
namespace baekjoon
{
class Program
{
static void Main(string[] args)
{
// 표준 입출력 스트림 reader,writer 만들기
// 9개의 자연수 입력받기, int로 바꾸기
// 이들 중 최댓값을 찾고
// 그 최댓값이 몇 번째 수인지 구해서 버퍼에 저장
// 버퍼 한 번에 비우기
StreamReader sr = new StreamReader(Console.OpenStandardInput());
StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
string strInput = sr.ReadLine();
int nNum = int.Parse(strInput);
int nMax = nNum; // 3
int nMaxIndex = 1;
for (int i = 1; i < 9; i++)
{
string strNewInput = sr.ReadLine();
int nNewNum = int.Parse(strNewInput); // 29, 38
if (nMax < nNewNum) // 3 < 29, 29 < 38
{
nMax = nNewNum; // 29, 38
nMaxIndex = i + 1; // 1, 2,
}
}
sw.WriteLine(nMax);
sw.WriteLine(nMaxIndex);
sw.Flush();
sr.Close();
sw.Close();
}
}
}