Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 제프리리처
- OS
- 우아한레디스
- 10026번
- 에러핸들링
- 이펙티브코틀린
- 2475번
- C++
- BOJ
- HTTP
- 운영체제
- FIFO paging
- redis
- Window-Via-c/c++
- C#
- Operating System
- TCP/IP
- 열혈 TCP/IP 소켓 프로그래밍
- Operating System.
- Four Squares
- 우아한 테크 세미나
- 김영한
- 스프링 입문
- 토마토
- inflearn
- n타일링2
- 윤성우 저자
- Spring
- 스프링 핵심 원리
- 열혈 tcp/ip 프로그래밍
Archives
- Today
- Total
나의 브을로오그으
[c++] 2562번 : 최댓값 본문
https://www.acmicpc.net/problem/2562
2562번: 최댓값
9개의 서로 다른 자연수가 주어질 때, 이들 중 최댓값을 찾고 그 최댓값이 몇 번째 수인지를 구하는 프로그램을 작성하시오. 예를 들어, 서로 다른 9개의 자연수 3, 29, 38, 12, 57, 74, 40, 85, 61 이 주어
www.acmicpc.net
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int nArr[9] = { 0, };
int nMaxIndex = 0;
for (int i = 0; i < sizeof(nArr) / sizeof(int); ++i)
{
cin >> nArr[i];
nMaxIndex = ((nArr[nMaxIndex] < nArr[i]) ? i : nMaxIndex);
}
cout << nArr[nMaxIndex] << '\n' << nMaxIndex + 1 << '\n';
return 0;
}
'알고리즘 > BaekJoon' 카테고리의 다른 글
[c++] 2675번 : 문자열 반복 (0) | 2022.03.11 |
---|---|
[c++] 2577번 : 숫자의 개수 (0) | 2022.03.11 |
[c++] 2475번 : Hello World! (0) | 2022.03.11 |
[c++] 2475번 : 검증수 (0) | 2022.03.11 |
[c++] 2439번 : 별 찍기-2 (0) | 2022.03.11 |