포럼
문제 ICPC00241

G. Game Rank

설명

The gaming company Sandstorm is developing an online two player game. You have been asked to implement the ranking system. All players have a rank determining their playing strength which gets updated after every game played. There are \(25\) regular ranks, and an extra rank, "Legend", above that. The ranks are numbered in decreasing order, \(25\) being the lowest rank, \(1\) the second highest rank, and Legend the highest rank.

Each rank has a certain number of "stars" that one needs to gain before advancing to the next rank. If a player wins a game, she gains a star. If before the game the player was on rank \(6\)-\(25\), and this was the third or more consecutive win, she gains an additional bonus star for that win. When she has all the stars for her rank (see list below) and gains another star, she will instead gain one rank and have one star on the new rank.

For instance, if before a winning game the player had all the stars on her current rank, she will after the game have gained one rank and have \(1\) or \(2\) stars (depending on whether she got a bonus star) on the new rank. If on the other hand she had all stars except one on a rank, and won a game that also gave her a bonus star, she would gain one rank and have \(1\) star on the new rank.

If a player on rank \(1\)-\(20\) loses a game, she loses a star. If a player has zero stars on a rank and loses a star, she will lose a rank and have all stars minus one on the rank below. However, one can never drop below rank \(20\) (losing a game at rank \(20\) with no stars will have no effect).

If a player reaches the Legend rank, she will stay legend no matter how many losses she incurs afterwards.

The number of stars on each rank are as follows:
- Rank \(25\)-\(21\): \(2\) stars
- Rank \(20\)-\(16\): \(3\) stars
- Rank \(15\)-\(11\): \(4\) stars
- Rank \(10\)-\(1\): \(5\) stars

A player starts at rank \(25\) with no stars. Given the match history of a player, what is her rank at the end of the sequence of matches?

제약
입력 형식

The input consists of a single line describing the sequence of matches. Each character corresponds to one game; 'W' represents a win and 'L' a loss. The length of the line is between \(1\) and \(10\,000\) characters (inclusive).

출력 형식

Output a single line containing a rank after having played the given sequence of games; either an integer between \(1\) and \(25\) or "Legend".

예제 1
입력
WW
출력
25
예제 2
입력
WWW
출력
24
예제 3
입력
WWWW
출력
23
예제 4
입력
WLWLWLWL
출력
24
예제 5
입력
WWWWWWWWWLLWW
출력
19
예제 6
입력
WWWWWWWWWLWWL
출력
18
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NCPC 2016

평가 및 의견

G. Game Rank

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

G. Game Rank

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8