1 条题解

  • 0
    @ 2025-6-28 16:55:57

    神好清,而心扰之

    题目怎么说,我们就怎么做。我给个只学过条件判断的做法。有些同学会在 22332233 这样的两个对子的数据点挂掉。

    #include <bits/stdc++.h>
    using namespace std;
    char temp;
    int a, b, c, d;
    int main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cin >> temp;
        a = temp - '0';
        cin >> temp;
        b = temp - '0';
        cin >> temp;
        c = temp - '0';
        cin >> temp;
        d = temp - '0';
    
        int ans = a + b + c + d;
    
        if (a == b && b == c && c == d)
            ans += b * b * b * b;
        else if (a == b && b == c || b == c && c == d)
            ans += b * b * b;
        else if (a == b && c == d)
            ans += a * a + c * c;
        else if (a == b || b == c)
            ans += b * b;
        else if (c == d)
            ans += c * c;
    
        if (a == 8 || a == 6)
            ans *= 2;
        if (b == 8 || b == 6)
            ans *= 2;
        if (c == 8 || c == 6)
            ans *= 2;
        if (d == 8 || d == 6)
            ans *= 2;
    
        cout << ans;
        return 0;
    }
    
    
    • 1

    信息

    ID
    1611
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    13
    已通过
    8
    上传者