1 条题解

  • 0
    @ 2023-11-26 19:39:21

    #include #include using namespace std; void Print(string sct1, string solt, string sct2) { for (int i = 0; i < sct2.size(); i++) { for (int j = 0; j < sct1.size(); j++) { if (sct2[i] == sct1[j]) { cout << solt[j]; break; } } } } bool Is(string sct1, string solt) { int count = 0; for (int i = 0; i < sct1.size(); i++) { for (int j = 0; j < sct1.size(); j++) { if (sct1[i] == sct1[j] && i != j) { if (solt[i] != solt[j]) { count++; break; } } } } if (count == 0) return true; else return false; } int main() { string sct1, solt, sct2; cin >> sct1 >> solt >> sct2; int c_char = 0; char character = 'A'; for (int i = 0; i < solt.size(); i++) { if (solt[i] == character) { c_char++; character++; i = -1; } } if (c_char != 26) { cout << "Failed" << endl; } else { if (Is(sct1, solt)) Print(sct1, solt, sct2); else cout << "Failed" << endl; } return 0; }

    • 1

    信息

    ID
    463
    时间
    1000ms
    内存
    128MiB
    难度
    8
    标签
    递交数
    486
    已通过
    77
    上传者