Submission

Status:

PPPPPPPTPTPPPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Bermmmm

Problemset: สุ่มสลับ

Language: cpp

Time: 0.195 second

Submitted On: 2025-10-07 09:42:59

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

int main() {
    cin.tie(NULL) -> sync_with_stdio(false);
    string n,m;
    int a,count;
    count = 1;

    cin >> a;
    cin >> n;
    m = n;
    sort(m.begin() , m.end());

    if (n==m) {
        cout << '1';
        return 0;
    }
    
    while(n != m) {
        next_permutation(m.begin(),m.end());
        count++;
        if (n == m) {
            break;
        }
    }

    cout << count;
    return 0;
}