Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: 38408

Problemset: สุ่มสลับ

Language: cpp

Time: 0.199 second

Submitted On: 2026-10-15 13:50:39

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

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

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

    int ans = 1;

    while (cur != s) {
        next_permutation(cur.begin(), cur.end());
        ans++;
    }

    cout << ans;

    return 0;
}