2021东北四省赛题解re

cf链接

链接: link.
链接: link.

i Takeaway

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

int price[8];

void init(){
    price[1] = 7;
    price[2] = 27;
    price[3] = 41;
    price[4] = 49;
    price[5] = 63;
    price[6] = 78;
    price[7] = 108;
}

int main(){
    init();
    int t;
    cin>>t;
    while(t--){
        int n;
        cin >> n;
        int now;
        int sum = 0;
        while(n--){
            cin >> now;
            sum += price[now];
        }
        if(sum>=120){
            sum -= 50;
        }else if(sum>=89){
            sum -= 30;
        }else if(sum>=69){
            sum -= 15;
        }
        cout << sum << endl;
    }
}

E-Easy Math Problem

构造

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

int main(){
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        n *= 6;
        cout << n << " " << 3 << endl;
        cout << n / 6 << " " << n / 3 << " " << n / 2 << endl;
    }
}

Master of shuangpin

模拟

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

map<string, string> mp;

bool func(string str) {
    mp["iu"] = "q";
    mp["ei"] = "w";
    mp["uan"] = "r";
    mp["ue"] = "t";
    mp["un"] = "y";
    mp["sh"] = "u";
    mp["ch"] = "i";
    mp["uo"] = "o";
    mp["ie"] = "p";
    mp["ong"] = "s";
    mp["iong"] = "s";
    mp["ai"] = "d";
    mp["en"] = "f";
    mp["eng"] = "g";
    mp["ang"] = "h";
    mp["an"] = "j";
    mp["uai"] = "k";
    mp["ing"] = "k";
    mp["uang"] = "l";
    mp["iang"] = "l";
    mp["ou"] = "z";
    mp["ia"] = "x";
    mp["ua"] = "x";
    mp["ao"] = "c";
    mp["zh"] = "v";
    mp["ui"] = "v";
    mp["in"] = "b";
    mp["iao"] = "n";
    mp["ian"] = "m";
    
    if (mp[str] != "") {
        return true;
    } 
    if (mp[str] == "") {
        return false;
    }
}

string judge(string str) {
    
    if (str.length() == 1) {
            cout << str << str ;
    } else if (str == "ang") {
        cout << "ah";
    } else if (str == "an") {
        cout << "an";
    } else if (str == "ai") {
        cout << "ai";
    } else if (str == "en") {
        cout << "en";
    } else if (str == "ao") {
        cout << "ao";
    }
    
    else {
        string substr = str.substr(0, 2);
    if (func(substr)) {
        if (func(str.substr(2))) {
            cout << mp[substr] << mp[str.substr(2)] ;
        }
        else
        cout << mp[substr] << str.substr(2) ;
    }
    else
    {
        if (func(str.substr(1))) {
            cout << str[0] << mp[str.substr(1)] ;
        }
        else 
        cout << str[0] << str.substr(1) ;
    }
    }
    
    return "";
}

int main() {
    string str;
    char s[6000];
    while (gets(s)) {
        for (int i = 0; s[i];i++){
        if (s[i] != ' ') {
            str += s[i];    
        } else {
            judge(str);
            cout << " ";
            str = "";
        }
    }
    judge(str);
    str="";
    s[0]=0;
    cout << endl;
    }
    return 0;
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

.0-0.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值