2021年浙大城市学院新生程序设计竞赛(同步赛) J Jiubei and Codeforces

题目链接:J-Jiubei and Codeforces_2021年浙大城市学院新生程序设计竞赛(同步赛) (nowcoder.com)

思路:求出原本的颜色和改变后的颜色,然后如果变化就按照格式输出,最后输出最后的颜色

#include<bits/stdc++.h>
using namespace std;


int main(){
	int t;
	cin >> t;
	int n, k;
	int a;
	while(t--){
		cin >> n >> k;
		string s, ss;
		for(int i = 0; i < n; i++){
			cin >> a;
			int kk = k + a;
			if(k < 1200){
				s = "Newbie";
			}else if(k < 1400){
				s = "Pupil";
			}else if(k < 1600){
				s = "Specialist";
			}else if(k < 1900){
				s = "Expert";
			}else if(k < 2100){
				s = "Candidate master";
			}else if(k < 2300){
				s = "Master";
			}else if(k < 2400){
				s = "International master";
			}else if(k < 2600){
				s = "Grandmaster";
			}else if(k < 3000){
				s = "International grandmaster";
			}else{
				s = "Legendary grandmaster"; 
			}
			if(kk < 1200){
				ss = "Newbie";
			}else if(kk < 1400){
				ss = "Pupil";
			}else if(kk < 1600){
				ss = "Specialist";
			}else if(kk < 1900){
				ss = "Expert";
			}else if(kk < 2100){
				ss = "Candidate master";
			}else if(kk < 2300){
				ss = "Master";
			}else if(kk < 2400){
				ss = "International master";
			}else if(kk < 2600){
				ss = "Grandmaster";
			}else if(kk < 3000){
				ss = "International grandmaster";
			}else{
				ss = "Legendary grandmaster"; 
			}
			if(s != ss){
				cout << s << " -> " << ss << endl; 
			}
			k = kk;
		}
		cout << ss << endl; 
	}
	return 0;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值