Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: 38408

Problemset: สุ่มสลับ

Language: cpp

Time: 0.194 second

Submitted On: 2026-10-10 23:20:03

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

int main() {
    int n;
    string want;
    cin >> n >> want;

    string start = "";
    for (int i = 0; i < n; i++) {
        start += char('A' + i);
    }
    
    int rank = 1;

    do {
        if (start == want) {
            cout << rank;
            return 0;
        }
        rank++;
    } while (next_permutation(start.begin(), start.end()));

    return 0;
}