Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
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
Archives
Today
Total
관리 메뉴

게임 개발 메모장

21. 마라톤 본문

문제 해결력 훈련

21. 마라톤

Dev_Moses 2024. 1. 9. 19:39

 

#include <iostream>

using namespace std;

int main()
{
	int n,m;
	cin >> n;

	int ResultArray[10000] = {0,};
	int PlayerArray[10000] = {0,};

	for (int i = 0; i < n; ++i)
	{
		cin >> m;
		PlayerArray[i] = m;
		ResultArray[i] = 1;
	}

	int Max = 0;
	bool IsCount = true;

	cout << "1 ";

	for (int i = 2; PlayerArray[i] != 0; ++i)
	{
		Max = PlayerArray[i];

		for (int j = i - 1; j >= 0; --j)
		{
			if (Max < PlayerArray[j])
			{
				ResultArray[i]++;
			}
		}
	}

	for (int i = 1; ResultArray[i] != 0; ++i)
	{
		cout << ResultArray[i] << " ";
	}
}

'문제 해결력 훈련' 카테고리의 다른 글

23. N!에서 0의 개수  (0) 2024.01.09
22. N!의 표현법  (0) 2024.01.09
20. 석차 구하기  (0) 2024.01.09
19. Jolly Jumpers  (0) 2024.01.09
18. 연속 부분 증가 수열  (0) 2024.01.09