1 solutions

  • 0
    @ 2025-6-4 12:44:26
    • 字母顺序:O > B > A > F > G > K > M(越靠前温度越高)。
      • 数字顺序:0 > 1 > ... > 9(越小温度越高)。

      • 先比较两个类别的字母部分,字母顺序靠前的类别温度更高。

      • 若字母相同,则比较数字部分,数字较小的类别温度更高。

    #include <bits/stdc++.h>
    using namespace std;
    #define int long long
    
    signed main() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        
        int t;
        cin >> t;
        
        map<char, int> mp;
        mp['O'] = 0;
        mp['B'] = 1;
        mp['A'] = 2;
        mp['F'] = 3;
        mp['G'] = 4;
        mp['K'] = 5;
        mp['M'] = 6;
        
        while (t--) {
            string s1, s2;
            cin >> s1 >> s2;
            
            int g1 = s1[1] - '0';
            int g2 = s2[1] - '0';
            
            if (mp[s1[0]] < mp[s2[0]]) {
                cout << "hotter" << endl;
            }
            else if (mp[s1[0]] > mp[s2[0]]) {
                cout << "cooler" << endl;
            }
            else {
                if (g1 < g2) {
                    cout << "hotter" << endl;
                }
                else if (g1 == g2) {
                    cout << "same" << endl;
                }
                else {
                    cout << "cooler" << endl;
                }
            }
        }
        
        return 0;
    }
    
    • 1

    Information

    ID
    1497
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    (None)
    # Submissions
    116
    Accepted
    35
    Uploaded By