1 solutions

  • 1
    @ 2021-12-4 11:18:00

    总所周知,kirk 是善良学长,每次出题都在默默关照大家

    题目分析

    经过分析可得,当 kirk 和 night 的答案相同就得两分,不同最多只能对一个,由此累加就是最高分

    当然两人运气有可能同时背时,可能一个都不对,最低分就是 0

    参考代码

    #include <iostream>
    using namespace std;
    
    void read(int n, char *str) {
        for (int i = 0; i < n; i++)
            cin >> str[i];
    }
    
    int main() {
        int n;
        cin >> n;
        char anwser1[n + 5], anwser2[n + 5];
        read(n, anwser1);
        read(n, anwser2);
        int score = 0;
        for (int i = 0; i < n; i++)
            if (anwser1[i] == anwser2[i])
                score += 2;
            else
                score++;
        cout << score << " " << 0 << endl;
        return 0;
    }
    
    • 1

    Information

    ID
    196
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    72
    Accepted
    25
    Uploaded By