本文主要是介绍Game Rank Gym - 101550G(模拟),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
直接模拟,题意是真的毒瘤
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>using namespace std;
typedef long long ll;char s[10005];int main() {scanf("%s",s + 1);int n = strlen(s + 1);int rank = 25,star = 0;for(int i = 1;i <= n;i++) {int bonus = 0,add = 0;if(s[i] == 'W' && s[i - 1] == 'W' && s[i - 2] == 'W' && rank >= 6 && rank <= 25) {bonus = 1;}if(s[i] == 'W') add = 1;star += add + bonus;if(rank == 0) {continue;}else if(rank >= 21 && rank <= 25) {if(star > 2) {rank--;star -= 2;}}else if(rank >= 16 && rank <= 20) {if(star > 3) {rank--;star -= 3;}}else if(rank >= 11 && rank <= 15) {if(star > 4) {rank--;star -= 4;}}else if(rank >= 1 && rank <= 10) {if(star > 5) {rank--;star -= 5;}}if(s[i] == 'L' && rank <= 20 && rank >= 1) {if(star == 0) {if(rank != 20) {rank++;if(rank >= 1 && rank <= 10) {star = 4;}else if(rank >= 11 && rank <= 15) {star = 3;}else if(rank >= 16 && rank <= 20) {star = 2;}}}else {star--;}}}if(rank == 0) {printf("Legend\n");}else printf("%d\n",rank);return 0;
}
这篇关于Game Rank Gym - 101550G(模拟)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!